Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

please MATLAB code to solve this question? 6. A piston, connecting rod, and cran

ID: 669192 • Letter: P

Question

please MATLAB code to solve this question?

6. A piston, connecting rod, and crank for an internal combustion engine is shown [4]. When combustion occurs, it pushes the piston down causing the connecting rod to turn the crank which causes the crankshaft to rotate, creating power. Plot the distance traveled by the piston, d, as a function of the angle, A. Assume the length of the connecting rod, L1 = 1' and the crank, L2 = 0.5'. This plot can help engineers designing the engine to select appropriate lengths and get desired performance characteristics. Due to symmetry about A, only plot angles from 0 to 180 degree.

Explanation / Answer

We have the value that L1=1 and L2=0.5 and hence we calculate the value provided from the equation below:-
d=L1cos(b)+L2cos(a)
Matlab code to compute this function:-
d=1*cosd(b)+0.5cosd(a)

%Limiting the value of x-axis and y-axis and line is drawn so that the graph is drawn.
xL = 180;
yL = 100;
line([0 0], yL); %x-axis
line(xL, [0 0]); %y-axis

%Looping into the loop for all the values of 'A' from 1 to 180.

for a=1:180

%Computing the value of b as per the formula provided in the question.

b=asind((0.5*sind(a))/1);
d=(1*cosd(b))+(0.5*cosd(a));

%This program will plot the graph with the corresponding values for 'A' and 'D'

plot(a,b)
end

Note: All the values computed inside the trigonometric function have been given the values in degrees and

the resulted is return on the degrees for the inverse function.