clf theta=linspace(0,2*pi,1000); %creates theta vector x=cos(theta);y=sin(theta); %creates x and y coordinates hbead=line(x(1),y(1),'marker','o',... 'markersize',15,'erase','xor','color','k'); %initial bead and gets handle htrail=line(x(1),y(1),'marker','.','color','r','erase','none'); axis([-1 1 -1 1]);axis('square'); for k=2:length(theta) set(hbead,'xdata',x(k),'ydata',y(k)); %cycle thru all positions set(htrail,'xdata',x(k),'ydata',y(k)); %cycle thru all positions drawnow % redraw end