Animating a simple 3D trajectory

23 ビュー (過去 30 日間)
Bolin
Bolin 2018 年 11 月 4 日
コメント済み: madhan ravi 2018 年 11 月 4 日
Hi,
I am trying to animate a simple 3D trajectory
I have written a code based off of an example from Youtube. I wish my trajectory could look like the one as shown in the example.
However, no matter how I adjust the pause parameter, I could never get it to work.
box on
plot3([0 1 0 0]', [1 0 0 1]', [0 0 1 0]')
axis([0 1 0 1 0 1]);
view(135, 13)
curve_1 = animatedline('LineWidth',1)
curve_2 = animatedline('LineWidth',1)
z = linspace(1,300,300)
hold on
for i = 1:length(z)
addpoints(curve_1, x2(:,1), x2(:,2), x2(:,3));
head_1 = scatter3(x2(:,1), x2(:,2), x2(:,3), 'filled', 'Marker');
drawnow
pause(0.5);
end
Can someone please take a look? I have included my data points.

採用された回答

madhan ravi
madhan ravi 2018 年 11 月 4 日
load vector.mat
box on
plot3([0 1 0 0]', [1 0 0 1]', [0 0 1 0]')
axis([0 1 0 1 0 1]);
view(135, 13)
curve_1 = animatedline('LineWidth',1)
curve_2 = animatedline('LineWidth',1)
z = linspace(1,300,300)
hold on
for i = 1:length(z)
addpoints(curve_1, x2(i,1), x2(i,2), x2(i,3));
head_1 = scatter3(x2(i,1), x2(i,2), x2(i,3));
drawnow
pause(0.5);
end
  3 件のコメント
Bolin
Bolin 2018 年 11 月 4 日
Thank you. What was I thinking!
madhan ravi
madhan ravi 2018 年 11 月 4 日
Anytime :)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAnimation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by