how to make drawnow for this figure
11 ビュー (過去 30 日間)
古いコメントを表示
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]
0 件のコメント
回答 (1 件)
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 件のコメント
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 Center および File Exchange で Animation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!