필터 지우기
필터 지우기

how to make drawnow for this figure

조회 수: 10 (최근 30일)
polo Mahmoud
polo Mahmoud 2020년 3월 18일
댓글: Devineni Aslesha 2020년 3월 26일
Hi
How do i make my figure plot from this to its negative point, so the figure goes back and forward ( the red line on the uploaded figure) in an animated figure:
figure
plot3(x_coor,z_coor,y_coor,'k','HandleVisibility','off');
hold on;
plot3(Px_coor,Pz_coor,Py_coor,'r','HandleVisibility','off');
x_coor = [0 1 2 3 4 5
1 2 3 4 5 6]
y_coor = [0 0 0 0 0 0
0 0 0 0 0 0]
z_coor = [0 0 0 0 0 0
0 0 0 0 0 0]
Px_coor = [0 1 2 3 4 5
1 2 3 4 5 6]
Pz_coor = [0 0 0 0 0 0
0 0 0 0 0 0]
Py_coor = [0 0.0225501852619405 0.0827680826631456 0.169761552175099 0.273470524612610 0.385480815448938
0.0225501852619405 0.0827680826631456 0.169761552175099 0.273470524612610 0.385480815448938 0.500000000000000]

답변 (1개)

Devineni Aslesha
Devineni Aslesha 2020년 3월 24일
To animate the red line shown in the attached figure, use the below code. Here, pause is used instead of draw to notice that the animation took place.
h = animatedline;
for t = 1:length(Px_coor)
addpoints(h,Px_coor(1,t),Pz_coor(1,t),Py_coor(1,t));
pause(0.5);
end
For more information, refer the following links.
  댓글 수: 4
polo Mahmoud
polo Mahmoud 2020년 3월 26일
Hi I wanted the red line go from 0.5 to -0.5 i the y-axis on the figure I uploaded. Such that it simulated the first modeshape of a canteliver beam
Devineni Aslesha
Devineni Aslesha 2020년 3월 26일
Change the coordinates from the code below to move the red line from 0.5 to -0.5 in the y-axis.
x_coor = [0 1 2 3 4 5];
y_coor = [0 0 0 0 0 0];
z_coor = [0 0 0 0 0 0];
Px_coor = [0 1 2 3 4 5 5 4 3 2 1 0];
Pz_coor = [0 0 0 0 0 0 0 0 0 0 0 0];
Py_coor = [0 0.0225501852619405 0.0827680826631456 0.169761552175099 0.273470524612610 0.385480815448938 -0.385480815448938 -0.27347052461261 -0.169761552175099 -0.0827680826631456 -0.0225501852619405 0];
figure(1)
plot3(x_coor,z_coor,y_coor,'k','HandleVisibility','off');
hold on;
h = animatedline;
for t = 1:length(Px_coor)
addpoints(h,Px_coor(1,t),Pz_coor(1,t),Py_coor(1,t));
pause(0.8);
end

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Animation에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by