Question: Write a MATLAB function called trajectory.m that computes the trajectory of a projectile launched at a specified angle theta and initial velocity v. The function

Write a MATLAB function called trajectory.m that computes the trajectory of a projectile launched at a specified angle theta and initial velocity v. The function should return the horizontal and vertical position in feet of the projectile in question and the time array corresponding to those coordinates in seconds. Function Name: trajectory.m Input Arguments: Angle in Radians (theta) : Velocity in ft/sec (v) Optional Input Argument: Number of Points (default value is 100) Output Arguments: Horizontal motion trajectory in feet (x) : Vertical motion trajectory in feet (y) : Time array corresponding to x and y in seconds (t) Function Steps Velocity components can be found using trigonometric identities: Vx= v*cos(theta) Vy=v*sin(theta) Horizontal flight is as provided below x=Vx*t Here, t ranges from 0 to time of flight (tf) where tf is computed using the below formula where g=32 ft/sec^2. Make sure t has linearly spaced values between 0 to tf based on the Number of points entered by the user (if not a default value of 100) tf=2Vy/g Vertical flight is provided below y= Vy*t-0.5*g2 Now, write a script file run_trajectory.m to call the trajectory() function with the following parameters theta as /4 and velocity (v) as 90 ft/sec and get output arguments as x , y and t. Make sure to clear all variables in workspace before calling the function. Visualize the horizontal and vertical motion trajectory and label the axis. Your plot should look something like Figure 1.

 Write a MATLAB function called trajectory.m that computes the trajectory of

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!