Say i have 3 arrays X, Y, Z full of data which correspond to the x co-ordinate, y co-ordinate and a value at that point, is it possible to plot this as a surface plot?(Co-ordinates correspond to mesh points of a 2D structure). My understanding of how they are plotted is limited and the using the help for surface() did not help.
Thanks

 채택된 답변

Star Strider
Star Strider 2016년 3월 10일

0 개 추천

I don’t know what your data are. If they are matrices, use the surf or mesh functions. The scatteredInterpolant function is another option. If they are vectors, I would use plot3 or scatter3.

댓글 수: 4

Waseem Aldeek
Waseem Aldeek 2016년 3월 10일
Thanks for your reply, The 3 arrays are all the same size (1 x 212), The X array contains x co-ordinates, the Y array y co-ordinates and the Z array arbitrary values. I wish my plot to reflect the Z values at each co-ordinate and perhaps change in color depending on the value. Is this not possible using surf? does it only use matrix data to plot?
Thanks gain!
Star Strider
Star Strider 2016년 3월 10일
The surf function only plots matrices. If your vectors are set up to be gridded (appropriately repeating values in your ‘x’ and ‘y’ vectors), you could reshape all of them to work with surf. If they are essentially random, then scatter3 would likely be best. If they are random and you want to display them as a surface, use scatteredInterpolant.
Waseem Aldeek
Waseem Aldeek 2016년 3월 29일
Thanks alot for your help, much appreciated!
Star Strider
Star Strider 2016년 3월 29일
My pleasure!

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

추가 답변 (0개)

카테고리

질문:

2016년 3월 10일

댓글:

2016년 3월 29일

Community Treasure Hunt

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

Start Hunting!

Translated by