How to extend a line plot and animate it?
4 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
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 Exchange で Animation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!