How to make this 3D plot?

5 次查看(过去 30 天)
Hello Everybody, can anyone help me how to get this plot if i have every variables in x, y, and z axis and i want to plot in 3D but i need my plot is rotating along Y axis and the plot result is like in the image. Thank You.

采纳的回答

Aquatris
Aquatris 2018-7-18
You need the location of each node and the vibration amplitudes (assuming circular orbits) or magnitudes in each direction (assuming elliptical orbits). Then you need to create ellipses or circles at each node location. Here is the modified code where I assumed Y is the node locations, X and Z are the vibrations at their respective nodes.
X = [0 4 5 -2 0 2 4 1 4 2];
Y = [0 1 2 3 4 5 6 7 8 9];
Z = [0 2 1 -3 -2 -1 3 1 3 -1];
theta = 0:0.01:2*pi;
for i = 1:length(X)
Xv = X(i)*cos(theta);
Zv = Z(i)*sin(theta);
Yv = repelem(Y(i),length(theta));
plot3([0 0],[0 Y(end)],[0 0],'r-',Xv,Yv,Zv,'k-');
hold on;
end
axis([-10 10 -10 19 -10 10])
grid on
This is not an optimized code. Each iteration of for loop draws one of the ellipses. One can optimize it by converting the for loop into a simple matrix multiplication. You should play with the aestetics option to obtain what you actually want.
  2 个评论
Leonardus Risky
Leonardus Risky 2018-7-18
it can't run becasue this error: Undefined function 'repelem' for input arguments of type 'double'.
Error in plotmodes (line 9) Yv = repelem(Y(i),length(theta));
but what i want is to how i plot the 3D line in the 3D plot is make a elipse along with Y axis if Y is the nodal location and X,Z axis is the response displacement. Thank You for your response.
Aquatris
Aquatris 2018-7-18
You might be using an older version where repelem function is not built-in. change that part to
Yv = Y(i)*ones(1,length(theta));
The image is the output of the code.

请先登录,再进行评论。

更多回答(1 个)

tarek hussein
tarek hussein 2022-10-6
how i can plot orbit of vibration of a rotating shaft with its center
x1=BD(1:10000,1 ) % the vibration vector readings in x direction
y1=BD(10000:15000,2) % the vibration vector readings in y direction
figure
p1= plot(x1,y1)
xlabel(' journal Disp in X direction');
ylabel('journal Disp in Y direction');
grid on

类别

Help CenterFile Exchange 中查找有关 Vibration Analysis 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by