Results 1 to 6 of 6

Math Help - Explicit Euler method

  1. #1
    Junior Member
    Joined
    Oct 2008
    Posts
    26

    Explicit Euler method

    Hi I want to write a program to solve these 2 ODEs, but I do know how to do it. Please help!

    y'_1 = -y_1 + y_2
    y'_2 = -100(y_2 - sin t) + cos t

    t is from 0 to 1 and with inital value y_1= 1, y_2 = 2.

    time step = 0.01
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Member
    Joined
    May 2006
    Posts
    244
    Quote Originally Posted by oxxiissiixxo View Post
    Hi I want to write a program to solve these 2 ODEs, but I do know how to do it. Please help!

    y'_1 = -y_1 + y_2
    y'_2 = -100(y_2 - sin t) + cos t

    t is from 0 to 1 and with inital value y_1= 1, y_2 = 2.

    time step = 0.01
    and what language are you expected to use?

    .
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Junior Member
    Joined
    Oct 2008
    Posts
    26
    If possible, Matlab is prefer, but C is ok i think. Thanks!
    Follow Math Help Forum on Facebook and Google+

  4. #4
    Member
    Joined
    May 2006
    Posts
    244
    Quote Originally Posted by oxxiissiixxo View Post
    Hi I want to write a program to solve these 2 ODEs, but I do know how to do it. Please help!

    y'_1 = -y_1 + y_2
    y'_2 = -100(y_2 - sin t) + cos t

    t is from 0 to 1 and with inital value y_1= 1, y_2 = 2.

    time step = 0.01
    Crude but should work:

    Code:
    function rv=IODE
      y=[1,2];
      rv=[0,y];
      dt=0.1;
      for t=0:dt:1-dt
          dydt=[y(1)+y(2),-100*(y(2)-sin(t))+cos(t)];
          y=y+dt*dydt;
          rv=[rv;[t+dt,y]];
      end
    returns an array each row consists of the time and the y's

    .
    Last edited by Constatine11; January 20th 2009 at 05:41 AM. Reason: tidy up the return value
    Follow Math Help Forum on Facebook and Google+

  5. #5
    Junior Member
    Joined
    Oct 2008
    Posts
    26
    thanks but I need to use the explicit euler method to solve this system
    Follow Math Help Forum on Facebook and Google+

  6. #6
    Member
    Joined
    May 2006
    Posts
    244
    Quote Originally Posted by oxxiissiixxo View Post
    thanks but I need to use the explicit euler method to solve this system
    It is explicit, and it is Eulers method. It uses equation 68 from here

    .
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Euler Method - IVP
    Posted in the Differential Equations Forum
    Replies: 1
    Last Post: May 15th 2010, 02:14 AM
  2. Euler Method
    Posted in the Math Software Forum
    Replies: 5
    Last Post: March 15th 2009, 03:58 PM
  3. euler's method
    Posted in the Calculus Forum
    Replies: 1
    Last Post: April 22nd 2008, 03:37 AM
  4. Euler's Method
    Posted in the Calculus Forum
    Replies: 2
    Last Post: October 1st 2007, 04:06 PM
  5. Euler's Method
    Posted in the Advanced Applied Math Forum
    Replies: 1
    Last Post: July 20th 2007, 11:07 AM

Search Tags


/mathhelpforum @mathhelpforum