Solve Part 4:

Part I: (40 pts) Use Euler’s method as I do. However, for the if-condition that identifies when the ball hits the wall or goes past the wall, modify the calculation by adding a linear interpolation. To do this, first assume the same equation of motion that would occur if the floor was not present. Then calculate the velocity that the ball will have just before the collision at 𝑦 = 0 using linear interpolation of a velocity versus height. Let us model the motion of the ball that is outside the time interval when it collides with the wall using a time resolution of 𝑑𝑡 = 0.001 seconds. At the wall, it will generally be the case that the time the ball hits the floor will not be a perfect multiple of 𝑑𝑡, but rather an incomplete time interval that must be ≤ 𝑑𝑡. As such, plan on making tArray() non-uniform. Once the collision between the ball and floor takes place, you should then track the flight of the ball upward initially, and follow it back down until the ball hits the floor again. At this point, you will have the same situation. This cycle can be repeated up to the maximum time of interest, which can be specified, although I used 20 seconds. Hint: Each time you work out the time that the ball hits the floor, you will need to modify the tArray to reflect starting at the floor with some initial velocity upward. Turn this script in as bouncingBallName01.m where Name is your first or last name. This will be version 01.
Part II: (25 pts) Now, within the if-condition block that identifies when the ball hits the wall or goes pass
the wall, modify the calculation by adding a sub-loop within this if-condition block. Within this subloop,
break up the 𝑑𝑡 into smaller intervals. Let us call this time interval 𝑑𝑡!"## . I suggest 𝑑𝑡!"## = 𝑑𝑡/1000.
The code is similar to my initial code, where the y position of the ball is rest to zero upon its change in
direction. The difference will be that the time interval for solving the differential equation numerically
using Euler’s method is much smaller. Construct the loop in a way that when you record the positions and
velocities, you will keep the same 𝑑𝑡 determined by the tArray(). This method is useful when modeling
the collision between ball and floor in detail. Turn this script in as bouncingBallName02.m
Part III: (15 pts) Do everything analytically. We know the exact equations of motion of the ball, except
during the collision. However, by assuming the collisions take place instantaneously, we can solve the
equations of motion up to the exact instant of time the ball touches the floor, and then, switch the velocity
using the coefficient of restitution, and then, solve the exact analytical equations again until the next exact
time the ball hits the floor. In this case, use non uniform 𝑑𝑡. Since you can calculate the time between
bounces, always plot 40 points between the times the ball bounces. In this way, you will have an exact
solution under the simplifying assumptions of the model. Turn this script in as bouncingBallName03.m
Part IV: (20 pts) Compare your three results. Discuss what you find, and describe how the results from
the three different approaches are similar and different. Write this as a paragraph (or more) in a WORD
document (or some other word processing means) and include graphs to support your discussion.