Im stuck and have no clue as to what to do for this Write an


I\'m stuck and have no clue as to what to do for this

Write and M-file (in matlab) program that will compute and plot the distance traveled by the piston as a function of the angle, A, for the given lengths of L1 and L2. The L1 and L2 are to be input from the matlab command window. The angle A will go from 0 to 180 degrees by increments of 0.5 degrees. For your plot, label the x-axis as \"A in degrees\", the y-axis \"distance in feet\", and make the title, \"Piston Distance\". We know from trigonometry that: d=L1cos (B)+L2cos (A)

And from the law of sines:
(sin (A)/L1) = (sin (B)/ L2) so that you can find B.

When you run the program use L1= 2 feet and L2= 1 foot. (note: this does not need to loop).

Solution

Matlab Program

>>L_1 = 2;

>>L_2 = 1;

>>R=L_2/L_1;

>>A_d=[0:5:180];

>>A_r=A_d*(pi/180);

>>B=asin(R*sin(A_r));

>>d=L_1*cos(B)+L_2*cos(A_r);

>>plot(A_d,d),xlabel(\'A(degrees)\'), ylabel(\'d(feet)\'), grid

 I\'m stuck and have no clue as to what to do for this Write and M-file (in matlab) program that will compute and plot the distance traveled by the piston as a

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site