How to make smoother surf plot

8 visualizaciones (últimos 30 días)
Baptiste Tarbouriech
Baptiste Tarbouriech el 8 de Nov. de 2018
Editada: jonas el 8 de Nov. de 2018
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 comentarios
Baptiste Tarbouriech
Baptiste Tarbouriech el 8 de Nov. de 2018
I know that is not a contour plot but my contour is made by meshgride and gridata we can see the results of these two on surf plot, that is not realy smooth, and that maybe explain why my contour is not so good... Yeah at Z>3 there is not so much points of measurement, so that you propose is to extrapolate values to obtain something more homogeneous right ? Is there a simple way to do that ?
jonas
jonas el 8 de Nov. de 2018
Editada: jonas el 8 de Nov. de 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.

Iniciar sesión para comentar.

Respuestas (1)

KSSV
KSSV el 8 de Nov. de 2018
Read about griddata and scatteredinterpolant. YOu can do interpolation and generate the plot you want.

Categorías

Más información sobre Surface and Mesh Plots en Help Center y File Exchange.

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by