Problem 6 - Projectile trajectory (plot of multiple data series) 3 solutions submitted (max: Unlimited) | View my solutions Consider the motion of an object modeled with ideal projectile motion (neglecting air resistance . The trajectory of the object can be derived from basic physics and is given by the formula: \[ y=x \tan \theta-\frac{1}{2} \frac{x^{2} g}{\left(v_{0} \cos \theta\right)^{2}}+y_{0} \] where \( y \) is the height, \( x \) is the horizontal distance in meters, \( \theta \) is the initial angle, \( g \) is the acceleration due to gravity \( \left(g=9.81 \mathrm{~m} / \mathrm{s}^{2}\right), v_{0} \) is the initial velocity in \( \mathrm{m} / \mathrm{s} \), and \( y_{0} \) is the initial height in meters. The range, \( d \), of the projectile is the horizontal distance it travels and can be determined using the formula: \( d=\frac{v_{0} \cos \theta}{g}\left(v_{0} \sin \theta+\sqrt{\left.\left(v_{0} \sin \theta\right)^{2}+2 g y_{0}\right)}\right. \) Write a script to calculate the following three trajectories:
Consider the motion of an object modeled with ideal projectile motion (neglecting air resistance). The trajectory of the object can be derived from basic physics and is given by the formula: \[ y=x \tan \theta-\frac{1}{2} \frac{x^{2} g}{\left(v_{0} \cos \theta\right)^{2}}+y_{0} \] where \( y \) is the height, \( x \) is the horizontal distance in meters, \( \theta \) is the initial angle, \( g \) is the acceleration due to gravity ( \( g=9.81 \mathrm{~m} / \mathrm{s}^{2} \) ), \( v_{0} \) is the initial velocity in \( \mathrm{m} / \mathrm{s} \), and \( y_{0} \) is the initial height in meters. The range, \( d \), of the projectile is the horizontal distance it travels and can be determined using the formula: \[ d=\frac{v_{0} \cos \theta}{g}\left(v_{0} \sin \theta+\sqrt{\left(v_{0} \sin \theta\right)^{2}+2 g y_{0}}\right) \] Write a script to calculate the following three trajectories: - Trajectory1: \( \theta_{1}=30^{\circ}, v_{0}=25 \mathrm{~m} / \mathrm{s}, y_{0}=3.5 \mathrm{~m} \) - Trajectory2: \( \theta_{2}=45^{\circ}, v_{0}=25 \mathrm{~m} / \mathrm{s}, y_{0}=3.5 \mathrm{~m} \) - Trajectory3: \( \theta_{3}=60^{\circ}, v_{0}=25 \mathrm{~m} / \mathrm{s}, y_{0}=3.5 \mathrm{~m} \) For each value of \( \theta \), generate a row vector of 200 evenly-spaced \( x \) values starting at 0 and ending at the range \( d \). Compute the associated row vectors of \( y \) values and assign the results to the variables named \( \mathrm{y} 1, \mathrm{y} 2 \), and \( \mathrm{y} 3 \) for \( \theta_{1}, \theta_{2} \), and \( \theta_{3} \) respectively. Use the plot command to generate a figure with a plot of all three trajectories on a single set of axes. Use MATLAB commands to add an appropriate title, axis labels, and legend to the figure.
Script (2) CReset ? MATLAB Documentation
Previous Assessment: 2 of 5 Tests Passed \( (40 \%) \) (x) Is trajectory 1 calculation correct? (Pretest) Variable y1 must be of size [1 200]. It is currently of size [200 1]. Check where the variable is assigned a value. Make sure you generated the \( x \)-values using the range for this trajectory with \( \theta=30^{\circ} \). Double check formulas for typos and order of operations. * Is trajectory 2 calculation correct? Variable y2 must be of size [1 200]. It is currently of size [200 1]. Check where the variable is assigned a value. Make sure you generated the \( x \)-values using the range for this trajectory with \( \theta=45^{\circ} \). Double check formulas for typos and order of operations. (x) Is trajectory 3 calculation correct? Variable y 3 must be of size [1 200]. It is currently of size [200 1]. Check where the variable is assigned a value. Make sure you generated the \( x \)-values using the range for this trajectory with \( \theta=60^{\circ} \). Double check formulas for typos and order of operations. Is there a single axes with all three plots present? Does your script include the MATLAB commands necessary to generate the figure as specified?