In playing a game of miniature golf, you are faced with the following problem. You must hit a golf ball across a rectangular surface, and have the ball land in a hole at the center of the far side of the rectangle.
What makes this difficult is that the surface is rocking back and forth, so that the golf ball will not travel in a straight line.
The rectangular surface is 8 meters wide and 10 meters across. You must shoot the golf ball from a position on the near side, exactly 2 meters from the left edge. The hole is in the center of the far side, just
beyond the edge of the rectangular surface.
We will use a coordinate system in which the x direction runs from left to right, and the y direction runs from the near side to the far side. The origin will be placed at the middle of the near side. Thus, you must shoot the golf ball from position (-2,0), and the hole is at position (0,10).
The surface rotates about an axis running between the points (0,0) and (0,10). The angle of rotation is given by j = 15 (p/180) sin(2t), where t is the time since the ball was hit (measured in seconds). (Thus the surface does not begin moving until the ball is hit.)
The motion of the ball is influenced by several things:
- the initial velocity, which (initially) we will assume is 3 meters/second
- the initial direction, which will be varied
- acceleration due to gravity (since at most times the surface will be at an angle)
- deceleration due to friction, which we will assume is equal to -.25 times the velocity
Make a movie of the motion of the golf ball. Use ode15s to solve the differential equations. You can use any initial direction you want, as long as the golf ball doesn’t fall off the surface, and as long as it hits the far side of the surface; you don’t need to get the ball to go into the hole. Each frame of the movie should illustrate the surface using a surface plot, and the path of the golf ball using plot3. Be sure to choose a viewpoint and axes that display the results effectively.
B Grade: Use fzero to determine the initial direction so that the ball goes into the hole. Modify your movie so that the golf ball is drawn as a sphere. (See “help sphere” for more information.)
A Grade: Make a two-dimensional movie showing how the path of the golf ball changes as the initial velocity is changed. (For each velocity, you must determine the initial direction so that the golf ball goes
into the hole).
Preliminary deadline: Wednesday, December 9
Final deadline: 9:30am, Monday, December 21
In all cases, you only need to send me the Matlab software that creates the movie. You do not need a report, but you do need to comment your programs. I can run your software to see the results. I will be out of town during exam week.