how to create a contour for a fittype object?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponse acceptée
Mike Garrity
le 8 Juil 2015
Modifié(e) : Mike Garrity
le 8 Juil 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)
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Spline Postprocessing dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!