how to create a contour for a fittype object?
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposta accettata
Mike Garrity
il 8 Lug 2015
Modificato: Mike Garrity
il 8 Lug 2015
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)
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Spline Postprocessing in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!