Project tasks

1. simulate.m

Produce the following commands in a Matlab M-Fille named simulate.m, and then run it. Watch carefully the behaviour of the crank and the driven link during these two cycles.

% This program simulates the mechanical system

figure(1)

THETA=linspace(0,2*pi,101);

for t=0:0.03:6

theta=2*pi*t/3;

% find coordinates of P

Xp=0.5*sin(theta); Yp=0.7+0.5*cos(theta);

% find coordinates of C

Xc=7.5*sin(theta)/sqrt(74+70*cos(theta));

Yc=(10.5+7.5*cos(theta))/sqrt(74+70*cos(theta));

axis([-1.2 1.2 -0.1 1.7]), axis('equal'), axis manual

hold on

plot([0 0],[0 0.7],'b')

plot([0 Xp],[0.7 Yp],'r') % (1)

plot([0 Xc],[0 Yc],'g')

plot(0.5*cos(THETA),0.7+0.5*sin(THETA),'k:') % (2)

hold off

pause(0.1), clf

end