Answered step by step
Verified Expert Solution
Question
1 Approved Answer
2 ) Filenames: bounce _ mod.py ENGR 1 0 3 _ HW 7 _ 2 . py a ) Create a module, bounce _ mod.py
Filenames: bouncemod.py
ENGRHWpy
a Create a module, bouncemod.py in which you define a function that calculates the trajectory
of a bouncing ball.
Function syntax: x z t bouncevthetaCRNdt
v: initial velocity of the ball ms
theta: angle of the initial velocity deg
CR: coefficient of restitution 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.
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
b Write a second script, ENGRHWpy in which you do the following
Define the input parameters to be passed to bounce.py ie v theta 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 pltfill to create a gray RGB values: ground plane, whose
thickness is of the maximum height of the entire trajectory.
Set the xaxis limits to range from zero to the next integer beyond the last point of the
trajectory.
Set the yaxis limits to range from the bottom of the gray ground area to 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: v theta
CR N and dte
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
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