The distance a freely falling object travels is X 12 GT2 wh
The distance a freely falling object travels is X = 1/2 GT^2 where g = acceleration due to gravity, 9.8 m/s^2 t = time in seconds x = distance traveled in meters. If you have taken calculus, you know that we can find the velocity of the object by taking the derivative of the preceding equation. That is, dx/dt = v = gt We can find the acceleration by taking the derivative again: dv/dt = a = g Create a function called free_fall with a single input vector t that returns values for distance x, velocity v, and acceleration g. Test your function with a time vector that ranges from 0 to 20 seconds.
Solution
function [x,vel,g] = free_fall(t):
g=9.8
syms
f(t)=0.5*g*t*t
dx=diff(f,t)
v(t)=gt
dv=diff(v,t)
vel=dx
g=dv
end
Test----------
for i=0:20
free_fall(i)
end
