フィルターのクリア

How to animate two functions at the same time?

4 ビュー (過去 30 日間)
Pablo González de la Parra
Pablo González de la Parra 2020 年 10 月 14 日
回答済み: Puru Kathuria 2020 年 10 月 23 日
I want the two points to run at the same time. But the point of the circle goes first in the animation, and then the point of the line goes after it is done. How can i make them start and finish at the same time?
r=5
l=20
f = @(t) plot(r*cos(t), r*sin(t), "ro", "MarkerFaceColor", "r", "MarkerSize", 16)
fanimator(f,"AnimationRange", [0 6*pi])
hold on
g = @(t) plot(r*cos(t)+sqrt(l^2-r^2*sin(t)*.2),0, "ro", "MarkerFaceColor", "r", "MarkerSize", 16)
fanimator(g,"AnimationRange", [15 25])
hold off
syms t
x = r*cos(t);
y = r*sin(t);
x1 = t;
y1 = t-t;
hold on
fplot(x, y, [0,2*pi])
title("Circulo")
hold off
hold on
fplot(x1, y1, [15, 25])
title("Linea Recta")
hold off
  2 件のコメント
Walter Roberson
Walter Roberson 2020 年 10 月 15 日
The example in fanimator shows two functions animated at the same time.
If you insert
playAnimation()
after the first hold off then both of the items will animate. It takes a while -- the second one does not start moving until nearly the end of the time the first one starts moving -- but they do both play.
Pablo González de la Parra
Pablo González de la Parra 2020 年 10 月 15 日
Thank you very much! That solved my problem. I really appreciate it!

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

採用された回答

Puru Kathuria
Puru Kathuria 2020 年 10 月 23 日
Hi,
Please refer this example, it has a detailed demonstration on a similar animation that you require and also refer this function which helps animation of objects.

その他の回答 (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