% Solve ode for Mars Rover
% set init speed
V0 = 67.056;
% set timeframe and discretization
tspan = 0:.05:6;
% set parameters -- note that these will be visible in anon function that
% follows K = drag coef, M = lander mass, Gm martian gravity
K = 1.2; M = 150; Gm = 3.688;
odeLanderVelocity = @(t,V)(Gm-K/M*V.^2);

[t V] = ode45(odeLanderVelocity,tspan,V0);
A = odeLanderVelocity(t,V);
plot(t,V,'r-');
hold on 
plot(t,A,'b-');
grid on 
hold off
xlabel('Time (sec)');
legend('Velocity[m/s]','Acceleration [m/s^2]');
title('Mars Lander EDL:Landing')
