Question: The trajectory of the object can be derived from basic physics and is given by the formula: y = x t a n - 1

The trajectory of the object can be derived from basic physics and is given by the formula:
y=xtan-12x2g(v0cos)2+y0
where y is the height in meters, x is the horizontal position in meters, is the initial angle, g is the acceleration due to gravity (9.81ms2),v0 is the initial velocity in ms, and y0 is the initial height in meters. The range, d, of the projectile is the total horizontal distance it travels before hitting the ground and can be determined using the formula:
d=v0cosg(v0sin+(v0sin)2+2gy02)
Code has already been provided to define values for v0(units of meters/second),(units of degrees), and y0(units of meters) and assigns them to the variables ve, theta, and y0, respectively. Add commands to compute the following and assign to the indicated output variables.
Calculate d for the given inputs. This is a single scalar value. Assign thisto the variable d.
Create a row vector of 200 equally-spaced x-values starting at 0 and ending at d and assign to the variable x.
Create a row vector of 200y-values that gives the height of the projectile corresponding to each x in the fist output and assign to the variable y.
Determine the coordinates (x,y) of the peak of the trajectory (i.e. the highest value of y and the corresponding value of x) and assign as a 2-element row vector to the variable xyPeak. You will need to use the max function in a different way to extract both the maximum value and the location in the vector (the index) where that maximum value occurs. Please see Matlab documentation on the max function.
Solve this problem using only vectorized code with no loops or if statements. Points will be lost if you use these. Note the values of ve, theta, and y0 are supplied to the function when it is run by MATLAB grader. Be sure not to overwrite these values in your code.
Script 0
Save
C Reset
MATLAB Documentation
The trajectory of the object can be derived from

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 Programming Questions!