Skip to content
Permalink
7bc47b8403
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
28 lines (26 sloc) 1014 Bytes
function h=projectile(v_mag,theta)
%input inital velocity v_mag
%input theta
angle=theta*(pi/180); %Converts the angle into radians
g=9.81; %acceleration due to gravity
x_position=2.37;%max x-position where the height will be calculated
hi=1.72; %height where the dart begins its projectile motion
vy=v_mag*sin(angle); %inital velocity in the y direction
vx=v_mag*cos(angle); %inital velocity in the x direction
t_air=x_position/vx; %The total flight time in seconds
y_d=(vy*t_air)-(.5*g*(t_air.^2)); %the y position not including the inital height
h=y_d+hi %Final height after including the inital height before thrown
%Pull function setdefaults
setdefaults
%plotting points
t= 0:.01:t_air; %range for the time from 0 to end of flight, space .01
x=vx*t %calculating x position
y_d=(vy*t)-(.5*g*(t.^2));%y position without inital height
y=y_d+hi %calculating y position
%Ploting x and y points
plot(x,y)
%axis labels and title
xlabel('x position')
ylabel('y position')
title('Projectile Motion of Darts')
end