Question: Write a program (python) to calculate and plot the position and the velocity of a linear piston connected to a crank through a connecting rod
Write a program (python) to calculate and plot the position and the velocity of a linear piston connected to a crank through a connecting rod as a function of crank angle. The crank shaft is rotating at a constant angular velocity. The equation for the piston position and velocity is respectively given by = + 2 22 = 2 2 22 where r is the crank radius, l is rod length, is the crank angle with the piston axis, and is the crank angular velocity. Assume l = 15 cm, and = 100 rad/s and for r = 3 cm and 5 cm, plot the position and velocity from = 0 to 360 with 1 step size. Plot both in one figure with 2 subplots. Your plot should look like the following:

Homework 5: Write a program to calculate and plot the position and the velocity of a linear piston connected to a crank through a connecting rod as a function of crank angle. The crank shaft is rotating at a constant angular velocity. The equation for the piston position and velocity is respectively given r' (u sure cose 12 -r2sin20 where r is the crank radius, l is rod length, is the crank angle with the piston axis, and is the crank angular velocity Assume 1 = 15 cm, and = 100 rad/s and for r-3 cm and 5 cm. plot the position and velocity from -0 to 360 with 1 step size. Note that 0 should be in radian if you are using math library for calculating sin(0) and cos(). Plot both in one figure with 2 subplots. Your plot should look like the following: Subplot for position Subplot for velocity Add plot labels and legends for different r values, and axes labels for each subplot. You need to search in the plot document for subplot options Challenge Modify your program to also find the maximum velocity of the piston and report the max velocity and corresponding crank angle to the user. Perform this search using a loop and your velocity data array. You should not use the built-in function for finding the maximum
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
