The coordinates of a projectile traveling through the air ca

The coordinates of a projectile traveling through the air can be calculated with the following equations: x = v_0t cos(theta) y = v_0t sin(theta) - 1/2 gt^2 where v_0 is the initial velocity (60 m/s) t is the time (seconds) theta is initial angle of the projectile relative to the ground (degrees) g is the acceleration due to gravity (9 81 m/s^2) Write a script to complete the following tasks: Allow- the user to interactively input the initial angle of the projectile theta (in degrees). Starting at an initial time t of 0 seconds, calculate the x and y coordinates of the projectile for each time value t until the y coordinates of the projectile reaches the ground (while y greaterthanorequalto 0). You will need to increase the value of time t by 0.1 seconds inside the loop. After the projectile reaches the ground, display the final x and y coordinates of the projectile to the screen using dips statements. Test Case 1: Test the script with theta = 25 degrees. Make sure the tests appear in the diary file, otherwise no point will be given to the problem!!

Solution

If I type in any value for u or a in the function I can get it to plot the graph. The problem here is when anyone assign
simply the a or u variable as shown in my function,it gives an error of being undefined

function [range]=parabolamc (u,a)

> a=(a*pi/180);

> t=linspace(0,u*sin(a)/16,500);

> x=u*cos(a).*t;

> y=u*sin(a).*t-16*t.^2;

> plot(x,y,\'b\')

> xlabel(\'time\');

> ylabel(\'height\');

> axis(\'equal\');

> range=u^2*sin(2*a)/32;

>

>

> u1={velocity1};

> u2={velocity2};

> a1={angle1};

> a2={angle2};

> % Function call on parabolamc

> range1=parabola(u1,a1);

> range2=parabola(u2,a2);

> averagerange=(range1+range2)/2;

>display(range1);

>display(range2);                                                                           

 The coordinates of a projectile traveling through the air can be calculated with the following equations: x = v_0t cos(theta) y = v_0t sin(theta) - 1/2 gt^2 wh

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site