Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

i already have my script written out...#1 not sure how to include a title in my

ID: 3754023 • Letter: I

Question

i already have my script written out...#1 not sure how to include a title in my published output? #2 not sure how to use the quadratic equation to calculate T_end and not sure how to use of statements to have matlab choose correct t_end equation.

Plot Irajectory of Projectile from Assignwel Part launch to ground in MATLAB . Hardcode all inputs (like Launch angle (0), Initial velocity (Vo). Initial Position (vo) no need to prove you can do 'user inpat here Make Certain that comments are "best ever" and that appropriate use of sections Published output should include a title (figure that out) Revise code so that the quadratic equation is used to calculate t end . . . Use IF statements to have MATLAB choose the correct root to the t end equation Plot the trajectory of the projectile Use subplot to make plots of (y vs. x), (y vs. t) and (x vs. t) Use sprintf (or other) to add key values in to title Use appropriate titles for plots and axes .

Explanation / Answer

% Governing Equations:

% X = X0 + V0x*t + (1/2)*Ax*t^2

% Y = Y0 + V0y*t + (1/2)*Ay*t^2

%% Initial Conditions
pkg load symbolic
X0 = 0;
Y0 = 15; % in meters
V0 = 25; % in m/s
Ax = 0; % in m/s^2
Ay = -9.8; % in m/s^2
theta = 20; % in degrees
syms t;


% Calculated and Derived Quantitites

theta_rad = theta*(pi/180);

V0x = V0*cos(theta_rad);
V0y = V0*sin(theta_rad);

Vx = V0*cos(theta_rad); % X component of velocity
Vy = V0*sin(theta_rad) + Ay*t; % Y component of velocity

X = X0 + V0x*t + .5*Ax*t.^2; % X component of position

Y = Y0 + V0y*t + .5*Ay*t.^2; % Y component of position

% Assuming t_end is the total time of the flight, t_end can be calculated by:
Y = Y0 = Y0 + V0y*t + .5*Ay*t.^2; % Y coordinate at the end of flight will be same as it was at the beginning

% Quadratic equation to calculate t_end:

% .5*Ay*t_end.^2 + V0y*t_end = 0;
% or we can write it as:
% -4.9*(t_end.^2) + 8.55*t_end = 0;

% Solving this quadratic equation by representing the equation as a vector of it's coefficients:

p = [-4.9 8.55 0];
r = roots(p);

% Deciding which root to consider:

for i = 1:2
if r(i)>0
t_end = r(i);
else
end
end

disp(t_end); % it prints the value of t_end = 1.7449

t = 0:.01:t_end
plot (X,Y)
hold on
plot(X,t)
plot(Y,t)

title('Projectile Motion Trajectory')
xlabel('X-xoordinate of projectile')
ylabel('Y-coordinate of projectile')