Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
function h = projectile(v_mag,theta);
%independant variables are inserted into the function, magnitude of the velocity and the angle of launch.
angle_in_radians=theta*(pi/180); %converts degrees to radians.
X_0=2.37; %Define given x distance in meters
Y_0=1.72; %Define y(0) height in meters
g=9.81; %Define force of gravity, m/s^2
t=X_0/(v_mag*cos(angle_in_radians)); %time value solved in seconds
h=Y_0+v_mag*sin(angle_in_radians)*t-(1/2)*g*t^2; %final height, in meters
fprintf('the final height of your projectile is %f\n',h) %display of output info in coherent sentence.
time_interval=0:0.01:t; %Define time interval in vector form (seconds)
x_interval=v_mag*cos(angle_in_radians)*time_interval; %Define x distance interval in vector form (meters)
y_interval=Y_0+4*sin(angle_in_radians)*time_interval-(1/2)*g*time_interval.^2; %Define y distance interval in vector form (meters)
setdefaults %Setting the defaults
end