Write a computer program to reproduce this figure FIGURE 818

Write a computer program to reproduce this figure (FIGURE 8-18 on textbook). Show the process and attach source code with your comments. Also upload the source code on courses. Follow similar procedure of Example 8-5 (textbook page 431), derive the 4-5-6-7 function (equation 8.25 on textbook page 434).i.e.

Solution

theta = [0:pi/10000:1];

% simple harmonic motion

a = (pi^2/2).*cos(pi.*theta);

plot(theta,a)

% cycloid

ac = 2*pi*sin(2*pi.*theta);

hold on

plot(theta,ac,\'m\')

xlabel(\'Theta\');

ylabel(\'Acceleration\');

% constant acceleration

for i = 1:length(theta)

if theta(i)<=1/2

acn(i) = 4;

else

acn(i) = -4;

end

end

plot(theta,acn,\'k\')

% modified trapezoid

for i = 1:length(theta)

if theta(i)<1/8

act(i) = 4.89.*sin(4*pi.*theta(i));

elseif theta(i)>1/8 && theta(i)<3/8

act(i) = 4.89;

elseif theta(i)>3/8 && theta(i)<4/8

act(i) = -4.89.*sin(4*pi.*theta(i));

elseif theta(i)>4/8 && theta(i)<5/8

act(i) = -4.89.*sin(4*pi.*theta(i));

elseif theta(i)>5/8 && theta(i)<7/8

act(i) = -4.89;

elseif theta(i)>7/8 && theta(i)<1

act(i) = 4.89.*sin(4*pi.*theta(i));

end

end

  

plot(theta,act,\'r\')

% modified sine

for i = 1:length(theta)

if theta(i)<1/8

acs(i) = 5.53.*sin(4*pi.*theta(i));

elseif theta(i)>1/8 && theta(i)<7/8

acs(i) = 5.53*sin((4*pi/3)*theta(i)+(pi/3));

else

acs(i) = 5.53.*sin(4*pi.*theta(i));

end

end

plot(theta,acs,\'g\')

thank you.

 Write a computer program to reproduce this figure (FIGURE 8-18 on textbook). Show the process and attach source code with your comments. Also upload the source

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site