Circular Motion Plot with Trajectory Enlargement

In high-precision motion control, such as machine tools, ball-screw stages, circular motion to investigate the zero-speed crossing performance is usually necessary. Motion contour should be carefully explored. In maneuvering control of a ship, circular turning motion is also required to study the ship performance.

The following codes can plot the graph:

``````step0=[-10 -5  0  5 10];
gain=10;
step=step0*gain;

R = 500;
xf=R+step;
angle=[0 45 90 135 180 225 270 315]*pi/180;
figure(1);hold on;
plot(0,0,'+');
for i=1:length(step);
if i==1 || i== length(step)
x=[xf(i) xf(i)];y=[-20 20];
else
x=[xf(i) xf(i)];y=[-12 12];
end
for j=1:length(angle)
RotM=[cos(angle(j)) -sin(angle(j));sin(angle(j)) cos(angle(j))];
a=RotM*[x;y];
plot(a(1,:),a(2,:),'k-');
end
end

x=[xf(1) xf(end)];y=[0 0];
for j=1:length(angle)
RotM=[cos(angle(j)) -sin(angle(j));sin(angle(j)) cos(angle(j))];
a=RotM*[x;y];
plot(a(1,:),a(2,:),'k-');
end

theta=0:0.1:2*pi+0.1;
x=R*cos(theta);
y=R*sin(theta);
plot(x,y,'b-');

dist = 5;
xt = x + dist*cos(6*theta);
yt = y;

% xt=squeeze(towermotion.data(1,indx))-71.25;
% yt=squeeze(towermotion.data(2,indx))-R;
% figure;plot(xt,yt);
theta = atan2(yt,xt);
en=sqrt(xt.^2+yt.^2)-R;
en_m=en*gain;
xt_m = (R+en_m).*cos(theta);
yt_m = (R+en_m).*sin(theta);
plot(xt_m,yt_m,'r-.');
``````