How to make smoother surf plot

조회 수: 8 (최근 30일)
Baptiste Tarbouriech
Baptiste Tarbouriech 2018년 11월 8일
편집: jonas 2018년 11월 8일
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
Baptiste Tarbouriech
Baptiste Tarbouriech 2018년 11월 8일
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 2018년 11월 8일
편집: jonas 2018년 11월 8일
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.

댓글을 달려면 로그인하십시오.

답변 (1개)

KSSV
KSSV 2018년 11월 8일
Read about griddata and scatteredinterpolant. YOu can do interpolation and generate the plot you want.

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by