how to plot a 3D surface from N by 3 matrix

6 次查看(过去 30 天)
I have a matrix with dimensions N by 3, for example 100 rows and 3 columns. Each row correspondds to the 3D location of a point, i.e., we have 100 points. I want to pot the 100 points and connect them as a surface.

采纳的回答

AdamG2013468
AdamG2013468 2019-8-22
Try,
S = size(matrix); %"matrix being your generic matrix
[X, Y] = meshgrid(1:S(2), 1:S(1));
Z = matrix; %e.g. 100 by 3 matrix
surf(X,Y,Z)
  2 个评论
mohamed Faraj
mohamed Faraj 2019-8-22
Hi Adam. The X matrix is 100 by 3 matrix of the form [1 2 3;1 2 3;1 2 3 ....]
AdamG2013468
AdamG2013468 2019-8-22
You should be able to use the code above, adjusting for your desired X, Y, Z axes values accordingly.

请先登录,再进行评论。

更多回答(1 个)

darova
darova 2019-8-22
Look for griddata()

类别

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