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

Midpoint Euler method, second order system

  1. Jun 12, 2013 #1
    Hello

    I need to plot this simple system:

    x'' = -x

    using midpoint Euler.

    u1 = -x , u2 = -x'

    u1' = u2
    u2' = -x

    u1(n+1) = u1(n) + h*?
    u2(n+1) = u2(n) + h*f((1/2)*(u1(n) + u1(n+1))

    We dont know u1(n+1). I tried approximating it with u1(n+1) = u1(n) + h*u2(n)

    u2(1+i) = u2(i) + h * ((-1/2) * (u1(n) + u1(n+1))

    Then we have u2(i+1) and u2(i). A midpoint value is (u2(1+i) - u(i))/2

    u1(q+i) = u1(i) + h*midpoint

    When i plot this the result is some awful diverging line, not an oscillating function. What is wrong?
     
  2. jcsd
  3. Jun 12, 2013 #2
    If you are using mid-point euler like this, then you need to move all the n+1 terms to the left sides of the two equations, and solve for u1(n+1) and u2(n+1) treating the equations as two simultaneous linear algebraic equations in two unknowns.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Midpoint Euler method, second order system
Loading...