looking to have 2 lines, same length, with the angle changing between them? Cant figure out how to animate this?

1 view (last 30 days)
help

Answers (1)

Image Analyst
Image Analyst on 25 Nov 2014
Use a for loop, line(), and pause(). If the lines are connected, you can use line() once. If the line segments are not touching, then it's probably easiest to call line twice with "hold on" in between (or else separate the two segments with nan's).
Sounds like homework so I'll just give a hint.
for angle = 0 : 360
x1 = ....
x2 = ....
x3 = .....
x4 = ....
x1 = ....
x2 = ....
x3 = .....
x4 = ....
line([x1,x2,x3,x4], [y1,y2,y3,y4]);
drawnow;
pause(.5); % Pause so we can see it.
end

Categories

Find more on Animation in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!