How to reshape 'Z' matrix for surf(X,Y,Z)

11 次查看(过去 30 天)
Hi. I am fairly new to MATLAB and I am trying to use surf to plot 3D surface plot for my modal curvature. i have meshed the grid and my X and Y matrices are of size 2000X2000. I want to reshape my 'Z' Matrix so that it becomes of size 2000X2000 from 2000X4.
Where 2000 is the number of elements in my beam and 4 is the vertices of those elements
Edit-Thank you guys for response but i have tried reshape(Z,2000,2000) before asking here. It is not working. Also I am using AEM based modelling so there are no nodes but the springs used for elements connections.
  1 个评论
Stephen23
Stephen23 2023-7-11
"Where 2000 is the number of elements in my beam and 4 is the vertices of those elements"
That sounds like you should use PATCH, rather than MESH:

请先登录,再进行评论。

回答(1 个)

Divyam
Divyam 2023-7-11
You can use the reshape function.
updatedZ = reshape(Z', 2000, 2000);
More information about the reshape function: Reshape array - MATLAB reshape - MathWorks India
  1 个评论
Stephen23
Stephen23 2023-7-11
"You can use the reshape function."
No, you cannot use RESHAPE to change an array with 8000 elements into an array with 4000000 elements.

请先登录,再进行评论。

类别

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