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
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.
回答(1 个)
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.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Surrogate Optimization 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!