I am animating some mechanical parts. For each time interval several "mechanical parts" change their positions. My problem is that my program will not clear the plots from the previous time intervals, so at the end the figure becomes a mix of all time intervals.
plot([A1(1) A2(1)],[A1(2) A2(2)],'r.')
plot([x1 x2],[y1 y2],'k');
plot([A1(1) x1],[A1(2) y1],'b-')
plot([A2(1) x2],[A2(2) y2],'b-')
I have used exactly the same method earlier and suceeded, but I have never had more than one plot for each time interval. How can I replace the previous image?