Writing a Script for a Function
Show older comments
Problem: A rocket is launched vertically. At time t=0, the rocket's engine shuts down. At that time, the rocket has reached an altitude of 500 meters and is rising at a velocity of 125 meters/second. Gravity then takes over. The height of the rocket as a function of time is: h(t) = -9.8t^2 +125t +500
Create a Function called rocket_height that accepts time as an argument and returns the height of the rocket. This function does not need to validate that time is greater than 0.
Create a script that - plots height versus time for times from 0, by 0.1 seconds, until the rocket hits the ground - finds the time when the rocket starts to fall back to the ground using the max function - labels the point on the plot with an arrow pointing to the location and text about occurrence
Issue: I am not exactly sure how to structure the script so it connects with my function command. I know I will have to create a while loop that goes from 0 by 0.1 until h(t)=0. I have already created the function command.
Accepted Answer
More Answers (0)
Categories
Find more on Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!