Project tasks
1. Produce
Produce the following commands in a Matlab m-file named simulate.m, and then run
it.
% This program simulates the mechanical system defined in device.m
figure(1);
for t=0:0.002:0.4;
theta=10*pi*t;
alpha=atan(sin(theta)./(3-cos(theta)));
% find coordinates of A
Xa=20*cos(theta); Ya=20*sin(theta);
% find coordinates of C
Xc=20*cos(theta)+85*cos(alpha); Yc=20*sin(theta)-85*sin(alpha);
axis([-20 105 -40 40]);
axis(’equal’);
axis manual; %(*)
hold on;
plot([0 Xa],[0 Ya],’b’);
plot([Xa Xc],[Ya Yc],’r’);
plot([-20 105],[0 0],’k:’);
text(-1.5,-1.5,’O’); text(58.5,-1.5,’B’)
hold off;
pause(0.01);
clf; %(*)
end;