How to make this 3D plot?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Leonardus Risky
il 18 Lug 2018
Risposto: tarek hussein
il 6 Ott 2022
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/192072/image.jpeg)
0 Commenti
Risposta accettata
Aquatris
il 18 Lug 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-');
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 Commenti
Aquatris
il 18 Lug 2018
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));
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/192353/image.jpeg)
The image is the output of the code.
Più risposte (1)
tarek hussein
il 6 Ott 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
figure
p1= plot(x1,y1)
xlabel(' journal Disp in X direction');
ylabel('journal Disp in Y direction');
grid on
0 Commenti
Vedere anche
Categorie
Scopri di più su Vibration Analysis in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!