Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TugboatEng on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

3d surface plot

Status
Not open for further replies.

GeorgeEllwood

Mechanical
Joined
Aug 22, 2006
Messages
134
Location
GB
Hello,
I was wondering if someone can help me with this problem. I would like to plot a 3d surface plot of 3 variables. Like in the attached image. Whatever I try I can't seem get it to work. Two of the variables are ok but the third doesn't plot properly. I've got a matrix 3 columns wide and I would like the surface to go through the point described by the coordinates of each row. I seem to remember being able to do this with Matlab years ago when I was at university but now I can't make it work.
Any help would be greatly appreciated.
Thanks
George
 
You can use your matrix in its form if its arranged in [x,y,z] presumably. The function surfc.m plots a 3d surface of a specified matrix.
For example if you have a matrix made up of vectors:
X=[1 2 3 4 5 6 7 8 9]; Y=[4 5 6 7 1 2 3 7 8]; Z=[5 5 5 5 5 5 5 5 5];
C=[X;Y;Z];
surfc(C)

This will give you a 3d surface plot of your matrix in Cartesian coordinates.

Good luck,



Fe
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top