global g % The value of g must be specified before using it in the function via ode45
g = 9.81;
options = odeset('AbsTol',1e-6,'MaxStep',5); % Set some options for ODE45
[t,output] = ode45(@AircraftExit,0:0.01:10,[10,0],options); % Set ODE45 odefcn function
function [bal] = AircraftExit(t,Input) % Execute equations of motion
global g
bal = [Input(2); % Velocity
-g]; % acceleration
end