# % Projectile Motion – Project (v1):

% Projectile Motion – Project (v1): Motion to Max Height

% Governing Equations

% x = x0 + V0x*t + 1/2*ax*t^2

% y = y0 + V0y*t + 1/2*ay*t^2

%% Initial Conditions

x0 = 0

y0 = 10 % m

V0 = 15 % m/s

ax = 0

ay = -9.8 % m/s^2

theta = 70 % degrees

dt = 0.05 % s

%% Calculated and Derived Quantities

theta_rad = theta * pi/180

V0x = V0 * cos(theta_rad)

V0y = V0 * cos(theta_rad)

%% Create the Time Vector

t = 0 : 0.1 : 5

%%

x = x0 + (V0x*t) + (0.5*ax*t.^2)

y = y0 + (V0y*t) + (0.5*ay*t.^2)

%% Plot

plot (x,y)

title (‘Trajectory of a Projectile’)

%% Use User Defined Input

%z = input (‘Enter a Title for the Graph(in single quotes)’)

plot (x,y), title (z)

z = ‘Trajectory of a Projectile’

plot (x,y), title (z2)

z2 = sprintf (‘Trajectory of a Projectile with V0=%f m/s and Angle %f degrees’, V0, theta)

title (z2)

“Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!”