フィルターのクリア

How to extend a line plot and animate it?

5 ビュー (過去 30 日間)
Pedro
Pedro 2023 年 11 月 26 日
コメント済み: Daniel 2023 年 11 月 26 日
I made a code for a four-bar mechanism, and for that I plot lines from Bx to Px and from By to Py in what I call an "elo", as you can see here:
Elo6 = plot([Bx(teta2) Px(teta2)],[By(teta2) Py(teta2)],'y',LineWidth=4); %This is the yellow line that connects the white dot to the red dot
Which gives me this (with a few extra elos and details):
However, I am simulating a mechanism for a garage door, and for that I need "Elo6" to be extandable a set amount for both of its ends just like in the following image (ignore the red dot outside):
The way I did this was by using some mechanism theory, but it only works for this especific case (I discovered and used coordinates for the two ends of the "door", just like in "Elo6"), I need a way to extend the elo so that if i change the rest of the mechanism, the "door" still works the same (Plotting independently from its ends coordinates).
I also made an animation of it by using a While True function and changing the values of "teta2", like this:
ii = teta2;
while 1
ii = ii+0.1
set(Elo6,'XData',[Bx(ii) Px(ii)]);
set(Elo6,'YData',[By(ii) Py(ii)]);
end
Would be nice if I could also animate the new door code using the same setup.
  2 件のコメント
Dyuman Joshi
Dyuman Joshi 2023 年 11 月 26 日
Daniel
Daniel 2023 年 11 月 26 日
The setup you're using now looks like what I do when I want to create animated things. What breaks?

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

回答 (0 件)

カテゴリ

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

製品


リリース

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by