How to plot a cross-section of a surface plot

29 vues (au cours des 30 derniers jours)
Shayan
Shayan le 5 Août 2011
I have a 3D plot that's generated by 3 900x900 matrices X,Y,Z. I want to plot the Z values at X==300micros(note:matrix dimension has nothing to do with values of X dimension) for all values of Y.
Any Idea how I could do this?

Réponse acceptée

Fangjun Jiang
Fangjun Jiang le 5 Août 2011
I think the function you are looking for is interp2(). For example:
M=10;
N=10;
X=-1:1/M:1;
Y=-1:1/N:1;
Z=membrane(1,M,N);
figure(1);surf(X,Y,Z);
x=0.3;
z=interp2(X,Y,Z,x,Y);
figure(2);plot(Y,z);
  1 commentaire
Shayan
Shayan le 5 Août 2011
I tried it works, YOU DA MAN!

Connectez-vous pour commenter.

Plus de réponses (1)

Jul Smith
Jul Smith le 17 Mai 2012
Hello, I have a file of contours that I want to visualiza in a cross section and another file of points x,y,z. How can I integrate point data into a cross section of those contours. I have tried interp function without success. Any ideas?
THANKS, Jul

Tags

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by