How to plot nodal displacement using mesh.m

19 次查看(过去 30 天)
Dear all,
I have a matrix with 3 colums such that:
X = mat(:,1); Y = mat(:,2); Z = mat(:,3)
With X,Y,Z being coordinates. Now i want to input different values for Z and plot the nodal displacement. However, my nodal displacement does nto come as a matrix but as a vector.
Any ideas?
  2 个评论
Dyuman Joshi
Dyuman Joshi 2023-2-14
How are you calculating the Nodal displacement? It's difficult to tell without any code or any context as to what you are trying to do.
Derek Cooper
Derek Cooper 2023-2-14
The nodal displacements are one column for the displacement in each direction.

请先登录,再进行评论。

回答(1 个)

Kartik
Kartik 2023-2-22
Hi,
Assuming that you have a vector of nodal displacements U that corresponds to the nodes in your mesh, you can use the mesh function in MATLAB to plot the nodal displacement. Here's an example code snippet that shows how to do this:
% Generate some example data
[X,Y] = meshgrid(0:0.5:5);
Z = sin(X) + cos(Y);
U = randn(size(Z));
% Create a mesh plot of the nodal displacements
mesh(X,Y,Z,U);
% Label the plot
xlabel('X');
ylabel('Y');
zlabel('Z');
title('Nodal Displacement');
% Add a colorbar to show the magnitude of the nodal displacement
colorbar;
In this code, the mesh function is used to create a 3D plot of the mesh with nodal displacements represented by the color of each node. The X, Y, and Z matrices represent the coordinates of each node in the mesh, and the U vector contains the nodal displacements. The colorbar function is used to add a colorbar to the plot, which shows the magnitude of the nodal displacement at each node.
You can modify this code to use your own data by replacing X, Y, Z, and U with your own matrices and vectors.

类别

Help CenterFile Exchange 中查找有关 Surrogate Optimization 的更多信息

产品


版本

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by