Permalink
Cannot retrieve contributors at this time
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?
roots_and_optimization/dprojectile_dtheta.m
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
14 lines (14 sloc)
862 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function [ d_h ] = dprojectile_dtheta( v_mag,theta) | |
%Pojectile (Calculate the height of a dart projectile) | |
% Input variables velocity and theta are used to find final height. | |
%--------- Assign Constants ----------------------------------------------- | |
d = 2.37; %distance to dartboard | |
h0 = 1.72; %initial height of dart | |
a = 9.81; %acceleration due to gravity | |
%--------- Operations ----------------------------------------------------- | |
vx = v_mag*cosd(theta); %calculate x-component of velocity | |
vy = v_mag*sind(theta); %calculate y-component of velocity | |
x = linspace(0,d,d*100+1); %create row vector for x values | |
t = x/vx; %calculate time at given x value | |
dh_vector = vy + (-a)*t; | |
d_h = dh_vector(238); |