projectile_motion.m 270 B

123456789
  1. function [x, y] = projectile_motion(p, t)
  2. g = 9.81;
  3. theta_0 = p.theta_0;
  4. velocity = p.velocity;
  5. height_initial = p.height_initial;
  6. x = velocity * cosd(theta_0) * t.^2;
  7. y = height_initial + velocity * sind(theta_0) * t - (1/2) * g * t.^2;
  8. end