Search code examples
matlabdifferential-equations

Define and solve nested non-linear ODE in MATLAB


I'm given the differential equation y'' = -g + a(t)/m with a(t) = k*y'^2 where y is a function of t (time). My initial conditions are y(0) = 600; and y'(0) = 0;

In MATLAB I know how to define y'' with

ydd = diff(y,t,2) == -g + a(t)/m;

but I'm lost at the fact that this is a 'nested' non linear differential equation and I'm not quite sure how to define it, let alone, solve it in MATLAB.


Solution

  • The better first order system is

    v' = -g + k/m*v^2
    y' = v
    

    as there is no longer a third unknown function a(t) involved.


    Challenge: Solve the first equation manually via separation of variables and partial fraction decomposition or identifying the scaling for the Area tangent hyperbolicus as the integral for the side of v.