Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2 ) Filenames: bounce _ mod.py ENGR 1 0 3 _ HW 7 _ 2 . py a ) Create a module, bounce _ mod.py

2) Filenames: bounce_mod.py
ENGR103_HW7_2.py
a) Create a module, bounce_mod.py, in which you define a function that calculates the trajectory
of a bouncing ball.
Function syntax: x, z, t = bounce(v0,theta0,CR,N,dt)
v0: initial velocity of the ball [m/s]
theta0: angle of the initial velocity [deg]
CR: coefficient of restitution -0<<=1. This is the ratio of vertical velocity
immediately after impact to the vertical velocity immediately before impact.
N: Number of impacts with the ground to include in the calculated trajectory
dt: time step difference between adjacent points in the time vector, t
Your function will calculate the trajectory of the bouncing ball over N bounces. That is, it will
calculate N trajectories, each of which is governed by the equations describing the motion of a
projectile.
()=0
()=01
22
What differs from one bounce to the next is the starting location, starting time, and initial
velocity.
The most challenging aspect of this assignment is accounting for the fact that each time and
location of impact does not, in general, correspond to a sampling interval. That is, because you
are calculating only a discrete number of points along the trajectory, in general, the initial points
calculated for all but the first trajectory, and the final points calculated for all N trajectories, will
not be at =0.
b) Write a second script, ENGR103_HW7_2.py, in which you do the following
Define the input parameters to be passed to bounce.py (i.e., v0, theta0, CR, n, and
dt).
Call bounce.py to calculate x, z, and t vectors for the trajectory of a bouncing ball.
Plot the resulting trajectory (z vs. x).
The plot should look like the plot below and should have the following characteristics.
Use plt.fill to create a gray (RGB values: [0.6,0.6,0.6] ground plane, whose
thickness is 10% of the maximum height of the entire trajectory.
Set the x-axis limits to range from zero to the next integer beyond the last point of the
trajectory.
Set the y-axis limits to range from the bottom of the gray ground area to 10% beyond
the maximum height of the trajectory.
The second line of the title should change according to the values of the parameters
passed to bounce.py.
You should experiment with a wide range of input parameters to verify that your function works
for all cases. When you submit your script, set the input parameters to: v0=5, theta0=50,
CR=0.8, N=10, and dt=1e-3.
Looking ahead to the next homework assignment, you will be using your bounce.py function to
create an animation of the bouncing ball

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Expert Oracle9i Database Administration

Authors: Sam R. Alapati

1st Edition

1590590228, 978-1590590225

More Books

Students also viewed these Databases questions