How to adjust the surface and contour in a surfc/meshc
Afficher commentaires plus anciens
Im having trouble plotting 3D data using surfc/meshc function. Im not able to adjust the gap between contour and surface graph. Im using the following code
xyz=[1.7 3.52 2.0 8.0 -150.5 -149.85]; f=load('adia_chpd.dat'); x=f(:,1); y=f(:,2); z1=f(:,3); xlin=linspace(min(x),max(x),60); ylin=linspace(min(y),max(y),60); [X,Y]=meshgrid(xlin,ylin); Z1=griddata(x,y,z1,X,Y,'linear'); %contour(X,Y,Z1,20,'LineWidth',2); C=gradient(Z1); %meshc(X,Y,Z1,C); surfc(X,Y,Z1,C,'FaceColor','none','EdgeColor','red'); axis(xyz) ylabel('$\mathbf{R(a_\circ)}$','Interpreter','latex','FontSize',15,'FontWeight','bold','VerticalAlignment','middle') xlabel('$\mathbf{r(a_\circ)}$','Interpreter','latex','FontSize',15,'FontWeight','bold','VerticalAlignment','bottom') set(gca,'FontSize',15,'LineWidth',2.0)
It gave me the following output

I want to get a plot that look like the following

How can I do that? Pls help
Réponses (1)
John BG
le 6 Fév 2016
If you lift the data, you decide the distance the surface shows up above X Y reference plane. It's not exactly your adia_chpd.dat, because you have not supplied it, but I have used a similar function:
x=0:1:100
[X,Y]=meshgrid(x)
Z=100+(-100+100*exp(-.001*X))./(0.01*exp(X/10))+(-100+100*exp(-.001*Y))./(0.01*exp(Y/10))
figure(1);mesh(Z)
C=gradient(Z);
figure(2);meshc(X,Y,Z,C);

just pull up when you extract z1:
z1=149.9-113+f(:,3)
with the surface I use:
Z2=150+(-100+100*exp(-.001*X))./(0.01*exp(X/10))+(-100+100*exp(-.001*Y))./(0.01*exp(Y/10))
figure(3);mesh(Z2)
C2=gradient(Z2);
figure(4);meshc(X,Y,Z2,C2);

Please if you find this answer useful, click on the thumbs-up above, thanks
John
1 commentaire
SAHEER VC
le 6 Fév 2016
Catégories
En savoir plus sur Surface and Mesh Plots dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!