tspan = [0 10]; x0 = [0 40]; [t y] = ode45('my_fun',tspan, x0); figure; plot(t, y(:,1)); hold on; plot(t, y(:,2),'r'); xlabel('time') ylabel('position and velocity');