Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

2nd-order ODE Euler's

  1. Mar 1, 2009 #1
    I'm trying to come up with an algorithm for solving second-order ode problems with euler's on matlab. the problem is that my matlab skills are very minimal! If anyone can point me in the right direction, it would be greatly appreciated!
  2. jcsd
  3. Mar 1, 2009 #2


    User Avatar
    Science Advisor
    Homework Helper
    Gold Member
    Dearly Missed

    Can't you just use a system of first-order equations to solve it?
  4. Dec 2, 2009 #3
    So for example, my function is:


    So converting it into two first orders would be:

    [tex]\frac{dy}{dt} = z[/tex]


    [tex]\frac{dz}{dt} = -9y[/tex]

    So as I understand,

    [tex]y' = \int{\frac{dz}{dt}} = -9yt[/tex]

    When I plug this into Matlab (with a Euler's ODE solver and initial guess of 1), it looks good for about a quarter of a period then levels off to zero. Should I be doing something with the z equation, or do I use it as a conceptual tool to solve the one equation?

    I'm sorry, this is very confusing for me, any help would be awesome.
  5. Dec 3, 2009 #4
    No, once you have defined z to be dy/dt you have the second equation in your system.

    So your system will be:


    You "track" the solution (both z and y) using a matrix form of Euler's method. But since the original equation was in terms of y, you'll output only the values of y.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook