Search code examples
mathmatlabdifferential-equations

Second order nonlinear differential equations using MATLAB


I'm trying to input a second order differential equation to solve into matlab over x = 0 to x =1. I can't figure out how. Here's the equation:

y'' = 1 + 0.1 \sqrt{1+(y')^2}

with initial conditions at zero.


Solution

  • Normally you solve higher-order equations by converting to a system of first order equations. Here, you would define:

    y' = v
    v' = 1 + 0.1 \sqrt{1 + v^2}
    

    Define a function computing the right-hand side, and use ode45.

    Note that this equation is solvable without much trouble in closed form, too, so should be a good test for how to do it.