I have a function called drawCircle include a small circle and a line to show rotate of circle.
function drawCircle(xCenter,yCenter,theta);
hold on
ang = 0 : 0.1 : 2*pi;
radius = 5;
x = radius * cos(ang) + xCenter;
y = radius * sin(ang) + yCenter;
h1=plot(x,y,'b','LineWidth',4);
theta=theta*pi/180;
u = radius* cos(theta);
v = radius * sin(theta);
h2=quiver(xCenter,yCenter,u,v,'b','LineWidth',3);
end
Also, I have a script file called moveCircle include a bigger circle.In moveCircle,I must call drawRobot and move the small circle on bigger circle . The problem is; while small circle moving, the previous small circles are not deleted. How can I delete them ?
hold on
axis([-50,50,-50,50])
xCenter = 5; yCenter = 5;
ang = 0 : 0.01 : 2*pi;
radius = 20;
x = radius * cos(ang) + xCenter;
y = radius * sin(ang) + yCenter;
plot(x,y);
for i=1:length(x)
drawRobot(x(i),y(i),theta);
M(i)= getframe(gcf);
end