Spring2008:Bouncing Ball Report:Beth Bradshaw
From GeoMod
Contents |
Abstract
This model is used to simulate a bouncing ball. The ball's initial position is (x=1,y=0,z=10); giving it an initial height of 10 along the z-axis. The ball has a radius of 1. The initial velocity of the ball in the z-direction is 0. The initial velocity of the ball in the x-direction is 1.
In order to make the model more realistic, a 75% decrease in velocity is assumed with each bounce of the ball. Meaning that each time the ball bounces it will lose 75% of its velocity. This velocity decrease is used to simulate the effect friction has on the ball when it comes in contact with the floor.
A simple experiment was done to see if the model actually simulates the real world. A tennis ball was dropped from a height of 1m and the height of each bounce of the ball was recorded.
Introduction
This model was made using Python code and visually expressed in VPython.
Methods
In the program the position of the x,y,&z-axes were set and the ball was positioned within the axes. The physical properties of the ball were then set. These properties include: radius, color, initial z-velocity, and x-velocity.
xaxis = curve(pos=[ (10, 0, 0), (0, 0,0)], color=(1,0,0)) yaxis = curve(pos=[ (0, 10, 0), (0, 0,0)], color=(0,1,0)) zaxis = curve(pos=[ (0, 0, 10), (0, 0,0)], color=(0,0,1)) ball1 = sphere(pos=(1,0,10), radius=1, color=(1,0,0), vel1z=0.0)
Constants and other initial conditions needed for the formulas were then written into the program.
gravity constant g = -9.8 change in time dt = 0.01 initial velocity ball1 vel1z = 0.0 initial time t = 0.0 x velocity vel1x = 1.0
The formulas are used to calculate the position and velocity of the ball over time.
t = t + dt vel1 = vel1 + g * dt ball1.pos.z = ball1.pos.z + vel1z * dt ball1.pos.x = ball1.pos.x + vel1x * dt
To simulate friction, the assumed 75% loss in velocity was written into the program.
vel1z = -vel1z * 0.75 vel1x = vel1x * 0.75
This model assumes no air resistance.
To see if the model simulates a real world situation, a simple experiment was done. A tennis ball was dropped from a height of 1m and the height of each bounce was recorded. This data was then entered into Excel and a graph was produced.
Results
When the model was run in Python, the ball fell from its initial height and also moved along the x-axis. The ball bounced off of the x-axis like it was supposed to, and the height of each bounce thereafter was reduced. Eventually, the force of friction slowed the ball so much that it appears to come to rest.
The results from the experiment varied from what is shown in the model. When the height of each bounce of the tennis ball was plotted on a graph, an exponential regression can be seen (see figure to the right).
It seems that the ball's height is reduced on each bounce according to the equation y=e^-0.5332x. This means that the original height of the ball is reduced exponentially by 0.5332 for each bounce (x=#of bounce).
Media:096.avi - video of bouncing tennis ball
Comments
The Python model may need to be adjusted to better simulate real life. The model assumed a 75% decrease in velocity on each bounce. I would suggest adjusting this value until the modeled data better fit the general exponential regression equation derived from actual data collected.
Calibration
To adjust the model to better simulate real life, a calibration must be done. The program must be adjusted so that it has the same parameters of the tennis ball experiment.
The initial height of the ball was changed to 1, and the radius of the ball was changed to 0.0625 (this is the actual radius of the tennis ball).
ball1 = sphere(pos=(1,0,1), radius=0.0625, color=(1,0,0), vel1z=0.0)
The model was run again, but still did not simulate the actual bouncing tennis ball. This means that the rate the velocity is decreased by needs to be changed. I tried three different values: 0.7, 0.8, and 0.78.
Decreasing the velocity by 0.78 on each bounce seemed to simulate the bouncing tennis ball the best.
if ball1.pos.z < 0.0625:
vel1z = -vel1z * 0.78
vel1x = vel1x * 0.78
ball1.pos.z = 0.0625
For the first two bounces of both the model and the tennis ball, the values were nearly equal. But for every bounce there after, the modeled bounce height was increasingly further away from the actual bounce height of the tennis ball.
An analytical calibration was also done. This calibration compares the modeled data for the position of the ball (from t=0 to t=0.44) to the analytical position of the ball (calculated using the equation: s1 = 0.5*g*t^2 + s0, which is; s = 0.5*g*t^2 + 1. The graph of these two data sets show an excellent correlation. However, the analytical position of the ball cannot be calculated using this equation after t=0.44, which is when the ball hits the ground.
Conclusion
The modeled data does not exactly match the actual data. When the two data sets are plotted on one graph, the difference is obvious (see figure).
When graphed, the modeled data display an exponential regression. However, the equation for the modeled data regression is y=10e^-0.3609x, and the equation for the actual data regression is y=e^-0.5332x.
I also plotted the position vs. time for the modeled and actual data. The results were similar to the graph showing the height of
each bounce. Both the actual and the modeled data produced a exponential regression. The equations are as follows: for the modeled
data y=10e^-0.2597x, for the actual data y=e^-0.5766x. (y = position at a time t)
The actual data, collected by bouncing a tennis ball, closely fit an exponential regression curve with the equation y=e^-0.5332x. A general equation that can be used to find the height of each bounce of any ball is then: y=yo*e^-0.5332x (y=height, yo=initial height, x=number of bounces). This equation is representative of an actual bouncing ball that is affected by the force of friction.
The Program
Python Code Before Calibration
from visual import *
scene.forward = (0, -0.5,1)
scene.up = (0,0,1)
scene.forward = (0, 1,0)
scene.lights = [vector(0, -10, 0)]
xaxis = curve(pos=[ (10, 0, 0), (0, 0,0)], color=(1,0,0))
yaxis = curve(pos=[ (0, 10, 0), (0, 0,0)], color=(0,1,0))
zaxis = curve(pos=[ (0, 0, 10), (0, 0,0)], color=(0,0,1))
ball1 = sphere(pos=(1,0,10), radius=1, color=(1,0,0), vel1z=0.0)
'''gravity constant'''
g = -9.8
'''change in time'''
dt = 0.01
'''initial velocity ball1'''
vel1z = 0.0
'''initial time'''
t = 0.0
'''x velocity'''
vel1x = 1.0
while 1:
#rate(60)
'''time'''
t = t + dt
print t
vel1z = vel1z + g * dt
ball1.pos.z = ball1.pos.z + vel1z * dt #+ 0.5 * g * dt * dt
ball1.pos.x = ball1.pos.x + vel1x * dt
if ball1.pos.z < 1:
vel1z = -vel1z * 0.75
vel1x = vel1x * 0.75
ball1.pos.z = 1
if vel1<0.05:
vel1=0.0
if vel1x<0.05:
vel1x=0.0
'''position of ball'''
s = 0.5*g*t*t + 10
print t,ball1.pos.z,s
Python Code After Calibration
from visual import *
scene.forward = (0, -0.5,1)
scene.up = (0,0,1)
scene.forward = (0, 1,0)
scene.lights = [vector(0, -10, 0)]
xaxis = curve(pos=[ (3, 0, 0), (0, 0,0)], color=(1,0,0))
yaxis = curve(pos=[ (0, 10, 0), (0, 0,0)], color=(0,1,0))
zaxis = curve(pos=[ (0, 0, 2), (0, 0,0)], color=(0,0,1))
ball1 = sphere(pos=(1,0,1), radius=0.0625, color=(1,0,0), vel1z=0.0)
'''gravity constant'''
g = -9.8
'''change in time'''
dt = 0.01
'''initial velocity ball1'''
vel1z = 0.0
'''initial time'''
t = 0.0
'''x velocity'''
vel1x = 1.0
while 1:
#rate(60)
'''time'''
t = t + dt
print t
vel1z = vel1z + g * dt
ball1.pos.z = ball1.pos.z + vel1z * dt #+ 0.5 * g * dt * dt
ball1.pos.x = ball1.pos.x + vel1x * dt
if ball1.pos.z < 0.0625:
vel1z = -vel1z * 0.78
vel1x = vel1x * 0.78
ball1.pos.z = 0.0625
if vel1z<0.05:
vel1z=0.0
if vel1x<0.05:
vel1x=0.0
'''position of ball'''
s = 0.5*g*t*t+1
print s

