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

6 visualizaciones (últimos 30 días)
mohamed Faraj
mohamed Faraj el 22 de Ag. de 2019
Comentada: AdamG2013468 el 22 de Ag. de 2019
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.

Respuesta aceptada

AdamG2013468
AdamG2013468 el 22 de Ag. de 2019
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 comentarios
mohamed Faraj
mohamed Faraj el 22 de Ag. de 2019
Hi Adam. The X matrix is 100 by 3 matrix of the form [1 2 3;1 2 3;1 2 3 ....]
AdamG2013468
AdamG2013468 el 22 de Ag. de 2019
You should be able to use the code above, adjusting for your desired X, Y, Z axes values accordingly.

Iniciar sesión para comentar.

Más respuestas (1)

darova
darova el 22 de Ag. de 2019
Look for griddata()

Categorías

Más información sobre Surface and Mesh Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by