Add x and y Values to z data from excel file

1 visualización (últimos 30 días)
Aidan Turner
Aidan Turner el 9 de Mzo. de 2021
Comentada: Star Strider el 10 de Mzo. de 2021
I have a 37x20 array in excel which corresponds to the magnitude of z value at each point. I would like to add the following x and y values to create a 3D matrix.
x=linspace(0,100,20)
y=linspace(0,28,37)
The resulting matrix would have coordinates of element 1 (0,0,(Value from z array))
Any help is greaty appreciated

Respuesta aceptada

Star Strider
Star Strider el 10 de Mzo. de 2021
It looks as though that would do exactly what you want.
For example, this:
z = rand(37,20); % Use Your ‘z’ Matrix Here
x=linspace(0,100,20);
y=linspace(0,28,37);
figure
surf(x, y, z)
grid on
xlabel('x')
ylabel('y')
zlabel('z')
will plot it appropriately.
  2 comentarios
Aidan Turner
Aidan Turner el 10 de Mzo. de 2021
Thank you very much for this, I had a problem with the plot3 command I think
Star Strider
Star Strider el 10 de Mzo. de 2021
As always, my pleasure!
The plot3 function accepts only vectors, that all must be the same lengths. The surf function requires the third argument to be a matrix, although the first two can be either vectors or matrices (with the appropriate sizes).

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Geographic Plots en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by