User:MrAlanKoh/MATLAB CODE DUMP

projectile motion

% define the initial velocity v0 = 10;

% define the angle theta = 45;

% define the gravity g = 9.81;

% define the time t = 0:0.1:2;

% calculate the x and y components of the velocity vx = v0 * cosd(theta); vy = v0 * sind(theta);

% calculate the x and y components of the position x = vx * t; y = vy * t - 0.5 * g * t.^2;

% plot the trajectory plot(x, y);

% add labels xlabel('x'); ylabel('y');