How to make smoother surf plot
8 views (last 30 days)
Show older comments
Hi,
I got some troubles with having a smooth surf plot of some points of measurement (plot3 in 3D) to finally obtain a perfect looking contour plot. If someone could give me some advices it would be helpfull.
Please check the currents results and the code.
if true
figure
plot3(V1,T1,N1,'o')
xlabel('v')
ylabel('c')
zlabel('n')
title('')
rangeY=min(T1):55:max(T1);
rangeX=min(V1):55:max(V1);
[X,Y]=meshgrid(rangeX,rangeY);
Z = griddata(V1,T1,N1,X,Y,'cubic');
figure
surf(X,Y,Z);
rangeZ=floor(min(N1)):0.1:ceil(max(N1));
figure
hold all
contour(X,Y,Z,[0 0.1 0.2 0.3 0.4 0.5 1 2 3 4 5 6 7 8 9],'showtext','on');
% plot(v100,t100,'r','linewidth',3)
% plot(vNTE,tNTE,'r','linewidth',3)
set(gca,'xlim',[800 2400],'xtick',800:100:2400);
set(gca,'ylim',[0 2500],'ytick',0:200:2500);
xlabel('v');
ylabel('c');
zlabel('n')
title('')
end


bye
4 Comments
jonas
on 8 Nov 2018
Edited: jonas
on 8 Nov 2018
It's quite simple, but I can't tell if the results will be any good. I think griddata and/or interp2 supports extrapolation. I also don't know if I would propose it, however, because extrapolation is often tricky and unreliable. I'd give it a try if you upload the data.
If your main concern is the smoothness rather than the discontinuous edges, then I would just increase the resolution in your meshgrid call.
Answers (1)
KSSV
on 8 Nov 2018
Read about griddata and scatteredinterpolant. YOu can do interpolation and generate the plot you want.
0 Comments
See Also
Categories
Find more on Surface and Mesh Plots in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!