I am making a basic game on matlab as part of an assignment and have decided to do a simple basketball simulation, where a user chooses the power and angle at which to throw the ball towards a net. The path of the ball is modelled in a for loop, in which the initial position of the ball is drawn, then the next position a small time later is calculated and drawn. The problem that I am having is that, because I have hold on, each of the previous images of the ball remains on the graph, instead of there being a continuous movement of the basketball. I was wondering how I could fix this? I have included an image below to help illustrate what I mean.