speed_for_angle.m 308 B

1234567
  1. function initial_velocity = speed_for_angle(p, theta)
  2. g = 9.81;
  3. height_difference = p.height_final - p.height_initial;
  4. top_term = g * p.displacement^2;
  5. bottom_term = 2 * cosd(theta)^2 * (p.displacement * tand(theta) - height_difference);
  6. initial_velocity = sqrt(top_term/bottom_term);
  7. end