Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using Matlab, please provide code. a Problem #5: In a game of mini-golf, a golf ball with displacement X(t) that begins at x(0) = 0

image text in transcribed

Using Matlab, please provide code. a Problem #5: In a game of mini-golf, a golf ball with displacement X(t) that begins at x(0) = 0 is to be struck with just enough initial velocity x'O) = V to stop at the top of a little hill. Because of the shape of the hill, the horizontal component of the force acting on the golf ball produces the ODE *" = 17 (x - 5) e-(x - 5)2 The top of the hill is at x = 5. Write a program to find x(t) from two first order ODEs using Heun's method with step size h = 0.01 to determine the displacement of the golf ball over time. Put Heun's method into a "for" loop that will continue for 5000 time steps (so until t = 50), but have the loop break if X(t) becomes less than zero (the ball doesn't make it up the hill and rolls backward) or if x(t) becomes greater than 10 (the ball has gone past the top of the hill and is rolling away). Begin with a velocity V = 42. You should find that the "for" loop is broken at time t = 0.24. To find the velocity V that will have the golf ball stop at the top of the hill, you will use a bisection method. In the bisection method, you will keep trying new guesses for V that are half-way between a previous V that was too small (Vmin) and a previous V that was too large (Vmax). Begin with Vmin = 0, and Vmax = 42 from above. Put the above "for loop into a while loop that continues while Vmax - Vmin is greater than 0.01. In each iteration, set V to the average of Vmin and Vmax , run the above "for loop, and check the result coming out of the "for loop. If the final displacement of the ball is less than 5, update Vmin to V, otherwise update Vmax to V. The code will then loop with a new guess halfway between the updated Vmin and Vmax ("bisecting" the low and high estimates) until Vmin and Vmax are sufficiently close together. Enter the final values for Vmin and Vmax (in that order), separated with a comma. Using Matlab, please provide code. a Problem #5: In a game of mini-golf, a golf ball with displacement X(t) that begins at x(0) = 0 is to be struck with just enough initial velocity x'O) = V to stop at the top of a little hill. Because of the shape of the hill, the horizontal component of the force acting on the golf ball produces the ODE *" = 17 (x - 5) e-(x - 5)2 The top of the hill is at x = 5. Write a program to find x(t) from two first order ODEs using Heun's method with step size h = 0.01 to determine the displacement of the golf ball over time. Put Heun's method into a "for" loop that will continue for 5000 time steps (so until t = 50), but have the loop break if X(t) becomes less than zero (the ball doesn't make it up the hill and rolls backward) or if x(t) becomes greater than 10 (the ball has gone past the top of the hill and is rolling away). Begin with a velocity V = 42. You should find that the "for" loop is broken at time t = 0.24. To find the velocity V that will have the golf ball stop at the top of the hill, you will use a bisection method. In the bisection method, you will keep trying new guesses for V that are half-way between a previous V that was too small (Vmin) and a previous V that was too large (Vmax). Begin with Vmin = 0, and Vmax = 42 from above. Put the above "for loop into a while loop that continues while Vmax - Vmin is greater than 0.01. In each iteration, set V to the average of Vmin and Vmax , run the above "for loop, and check the result coming out of the "for loop. If the final displacement of the ball is less than 5, update Vmin to V, otherwise update Vmax to V. The code will then loop with a new guess halfway between the updated Vmin and Vmax ("bisecting" the low and high estimates) until Vmin and Vmax are sufficiently close together. Enter the final values for Vmin and Vmax (in that order), separated with a comma

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Finance questions