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.
댓글 수: 0
채택된 답변
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
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
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
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Vibration Analysis에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!