Effacer les filtres
Effacer les filtres

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

14 vues (au cours des 30 derniers jours)
Ashish Srivastava
Ashish Srivastava le 11 Juil 2023
Commenté : Stephen23 le 11 Juil 2023
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 commentaire
Stephen23
Stephen23 le 11 Juil 2023
"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:

Connectez-vous pour commenter.

Réponses (1)

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

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by