Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Solve in MATLAB Problem 1: Snowball Throw le program to show the trajectory of a thrown snowball. Your file should prompt the user to Write

Solve in MATLAB

image text in transcribed

Problem 1: Snowball Throw le program to show the trajectory of a thrown snowball. Your file should prompt the user to Write an M-fi enter the initial velocity in feet per second and the angle in degrees. The goal of the user is to hit the hat of a person five feet tall and fifty feet away. To show the hat (target), plot a point at (50,5), e.g., plot (distance,height, 50,5, 'rs', 'MarkerSize',7) This will plot the hat shaped as a red square. You may need to alter the marker size according to what you think looks good. On the x-axis of the plot, vary the message depending on the following situations Wow a hit!" if within 0.1 feet of hat. "Close" if within 1 foot of hat. * "Too far!" if snowball overshoots by more than a foot. * "Too short!" if snowball falls short by more than a foot. These are all based on measurements in the vertical direction. At the end of your code, print (nicely formatted) two sets of initial velocity and angle that will hit the hat. Note that you solved a similar problem for Lab 3, so you can look back at those calculations. Here are some other hints: 1. This problem is posed in US Customary units, so use g-32.2 ft/s2, and the initial velocity will be in ft/s. 2. Calculate t hit and use a time step of t hit/100. 3. You need the x-distance traveled, which is equal to the initial velocity multiplied by the time (i.e there is no acceleration in the horizontal direction) It is unlikely that your distance vector will contain the number "50" exactly. Examine the built-in interpolation function in MATLAB interpl for this. Use an if statement to select the proper xlabel depending on the four conditions. You may add any extra feedback that vou wish. Ignore any error message vou get about the labeling of the x- axis To make the plot have equal scales on both axes, use axis 4. 5. 6. equal, ) Problem 1: Snowball Throw le program to show the trajectory of a thrown snowball. Your file should prompt the user to Write an M-fi enter the initial velocity in feet per second and the angle in degrees. The goal of the user is to hit the hat of a person five feet tall and fifty feet away. To show the hat (target), plot a point at (50,5), e.g., plot (distance,height, 50,5, 'rs', 'MarkerSize',7) This will plot the hat shaped as a red square. You may need to alter the marker size according to what you think looks good. On the x-axis of the plot, vary the message depending on the following situations Wow a hit!" if within 0.1 feet of hat. "Close" if within 1 foot of hat. * "Too far!" if snowball overshoots by more than a foot. * "Too short!" if snowball falls short by more than a foot. These are all based on measurements in the vertical direction. At the end of your code, print (nicely formatted) two sets of initial velocity and angle that will hit the hat. Note that you solved a similar problem for Lab 3, so you can look back at those calculations. Here are some other hints: 1. This problem is posed in US Customary units, so use g-32.2 ft/s2, and the initial velocity will be in ft/s. 2. Calculate t hit and use a time step of t hit/100. 3. You need the x-distance traveled, which is equal to the initial velocity multiplied by the time (i.e there is no acceleration in the horizontal direction) It is unlikely that your distance vector will contain the number "50" exactly. Examine the built-in interpolation function in MATLAB interpl for this. Use an if statement to select the proper xlabel depending on the four conditions. You may add any extra feedback that vou wish. Ignore any error message vou get about the labeling of the x- axis To make the plot have equal scales on both axes, use axis 4. 5. 6. equal, )

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Mastering Big Data Interview 751 Comprehensive Questions And Expert Answers

Authors: Mr Bhanu Pratap Mahato

1st Edition

B0CLNT3NVD, 979-8865047216

More Books

Students also viewed these Databases questions

Question

Be straight in the back without blowing out the chest

Answered: 1 week ago