How to make this 3D plot?
2 views (last 30 days)
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 on 18 Jul 2018
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-');
axis([-10 10 -10 19 -10 10])
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.
More Answers (1)
tarek hussein on 6 Oct 2022
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
xlabel(' journal Disp in X direction');
ylabel('journal Disp in Y direction');