Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Solve in MATLAB

image text in transcribed

Problem 1: Snowball Throw Write an M-file program to show the trajectory of a thrown snowball. Your file should prompt the user to 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/s, and the initial velocity will be in fts 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 interp1 for this 4. 5. Use an if statement to select the proper xlabel depending on the four conditions. You may add any extra feedback that you wish. Ignore any error message you get about the labeling of the x- axis 6. To make the plot have equal scales on both axes, use axis ('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_step_2

Step: 3

blur-text-image_step3

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 Databases questions

Question

5. Describe the relationship between history and identity.

Answered: 1 week ago