Question
Could somebody please complete the following in MATLAB? Knowing that the center of the piston, P2, moves along the vertical axis, write the set of
Could somebody please complete the following in MATLAB?
Knowing that the center of the piston, P2, moves along the vertical axis, write the set of equations needed to calculate the P1x, P1y, and P2x, P2y in terms of L1, L2 and the angle . 1. Write an M-script that will simulate the geometry for the motion of the piston by computing and storing the values of P1x, P1y, and P2x, P2y at each value of as is incremented from 0 deg. to 360 deg. This program will have the following requirements: It must request inputs for the crank length (L1) and the connecting link length (L2). o These values should be screened during the input process to make sure they make sense physically, that is (L1 > 0) and (L2 > L1). o A while loop should be used with the input screening process. It should use five separate, 1-dimensional arrays (vectors) to store (theta) and the coordinates of P1 and P2 (P1x, P1y, P2x, P2y) Using a for loop, the program should index the air-compressor through a complete rotation of the crank in deg intervals. One possible strategy would be: o set an increment for of o determine number of segments the "circle" will be divided into, n = round(360/) o use the sequence i = 1:(n+1) o then the value for each time in the loop would be (i) = (i-1)* o and each time in the loop, the variables would be stored in: P1x(i), P1y(i), and P2x(i), P2y(i)
2. After completing the calculations for all of the points, generate the following two plots: o Plot P1x, P1y, P2x, and P2y each vs in the same plot. o Plot P1y vs P1x (this means P1x is the abscissa and P1y is the ordinate) o each curve should be plotted without markers but with different line styles because they represent functions o Each plot title should describe which plot it is and contain the values for L1 and L2 used for the model. o Vertical and horizontal axes should be labeled. o If the plot contains more than one line of data, it should have a legend
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started