How can I plot x y z coordinates

조회 수: 78 (최근 30일)
Ioanna Stamataki
Ioanna Stamataki 2015년 10월 9일
댓글: Ioanna Stamataki 2015년 10월 9일
Hello,
I have a 3x10 matrix and columns 1, 2 and 3 represent x,y and z coordinates respectively.
I want z to be used for the color data and surface height. I have tried with mesh/surf and other commands but it does not plot the z axis as the surface height.
Any help?
I have tried simple things such as: matrix=xlsread(filename); surf(matrix);
or matrix=xlsread(filename); X = matrix(:,1); Y = matrix(:,2); [x,y]=meshgrid(X,Y); Z = matrix(:,3); surf (x,y,Z);
but here I get the following message: 'Z must be a matrix, not a scalar or vector'
Any help with the coding would be appreciated, I am just trying to visualise some results. Thanks, Jo

채택된 답변

Thorsten
Thorsten 2015년 10월 9일
One way to visualize your data would be
plot3(X,Y,Z, 'o')
  댓글 수: 1
Ioanna Stamataki
Ioanna Stamataki 2015년 10월 9일
Thank you Thorsten.
This works!
Is there a way to visualise them with colours? Like a surface plot?

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

추가 답변 (0개)

카테고리

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