how to create a contour for a fittype object?
2 ビュー (過去 30 日間)
古いコメントを表示
Hi,
i've fitted a surface for a scattered data using the following commands:
load('full_data.mat')
ft = fittype( 'poly11' );
opts = fitoptions( 'Method', 'LowessFit' );
opts.Normalize = 'on';
opts.Robust = 'LAR';
[fitresult, gof] = fit( [full_data(:,1), full_data(:,2)], full_data(:,3), ft, opts );
is it possible to plot the contours for this surface after i plotted the surface itself using the next command:
plot(fitresult, [full_data(:,1), full_data(:,2)], full_data(:,3) );
thank you for your help.
0 件のコメント
採用された回答
Mike Garrity
2015 年 7 月 8 日
編集済み: Mike Garrity
2015 年 7 月 8 日
One simple way is to get the data from the surface that the plot method creates.
h = plot(fitresult, [full_data(:,1), full_data(:,2)], full_data(:,3) );
s = findobj(h,'Type','surface');
figure
contour(s.XData,s.YData,s.ZData)
The "cleaner" option would be to use the feval method. You need to pass in the XData and YData. Something like this:
load franke
T = table(x,y,z);
f = fit([T.x, T.y],T.z,'linearinterp');
[x,y]=meshgrid(linspace(500,3500,40),linspace(0,1,40));
z=feval(f,x,y);
contour(x,y,z)
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Spline Postprocessing についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!