How to extend a line plot and animate it?
조회 수: 3 (최근 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!