Results 1 to 6 of 6

Math Help - Runge Kutta

  1. #1
    Member
    Joined
    Mar 2009
    Posts
    76

    Question Runge Kutta

    Hi, I'm trying to solve

    y''' - 2sin(t)y'' - yy' - y = 2cos(t) where y(0)=0, y'(0) = 1, y''(0) = 2 on 0<=t<=1 using the Runge Kutta method in Matlab, but I'm having a really hard time. I have the scheme to solve an equation like y(-2t + 1/t), but I'm not sure what to do for the higher order system. My textbook talks about it breifly, saying something about breaking it down into separate equations, but I'm lost. Please help!
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4
    Quote Originally Posted by gummy_ratz View Post
    Hi, I'm trying to solve

    y''' - 2sin(t)y'' - yy' - y = 2cos(t) where y(0)=0, y'(0) = 1, y''(0) = 2 on 0<=t<=1 using the Runge Kutta method in Matlab, but I'm having a really hard time. I have the scheme to solve an equation like y(-2t + 1/t), but I'm not sure what to do for the higher order system. My textbook talks about it breifly, saying something about breaking it down into separate equations, but I'm lost. Please help!
    Introduce the state vector:

    {\rm{X}}(t)=\left[\begin{array}{c}<br />
y(t)\\y'(t)\\y''(t)<br />
\end{array}\right]

    Then:

    {\rm{X}}'(t)=\left[\begin{array}{c}<br />
y'(t)\\y''(t)\\y'''(t)<br />
\end{array}\right]<br />
=\left[\begin{array}{c}<br />
{\rm{X}}_2(t)\\{\rm{X}}_3(t)\\2\cos(t)+{\rm{X}}_1(  t)+{\rm{X}}_1(t){\rm{X}}_2(t)+2\sin(t){\rm{X}}_3(t  )<br />
\end{array}\right]

    Now you apply the RK method to this first order vector ODE.

    CB
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Member
    Joined
    Mar 2009
    Posts
    76
    Okay thanks. I'm trying to find the actual solution in Matlab, but it's not working... it says "Warning, explicit solution cannot be found." Do you know how I might find the actual solution? When I try to find the solution on there for the example in the book it works fine, but both Matlab and Maple won't solve this equation for me. I did out the first step on paper when j=0, and I just kind of want to find out if I'm doing it right before I write out the whole program.
    Follow Math Help Forum on Facebook and Google+

  4. #4
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4
    Quote Originally Posted by gummy_ratz View Post
    Okay thanks. I'm trying to find the actual solution in Matlab, but it's not working... it says "Warning, explicit solution cannot be found." Do you know how I might find the actual solution? When I try to find the solution on there for the example in the book it works fine, but both Matlab and Maple won't solve this equation for me. I did out the first step on paper when j=0, and I just kind of want to find out if I'm doing it right before I write out the whole program.
    The thread title was "Runge-Kutta", that is a numerical method. It will find a numerical solution even if there is not known closed form solution.

    CB
    Follow Math Help Forum on Facebook and Google+

  5. #5
    Member
    Joined
    Mar 2009
    Posts
    76
    Ohh okay, thanks. I think I got it working, but I think I'm suppose to have a function like

    function a=f(t,u)
    a=zeros(1,3);a(1)=u(2);
    a(2)=u(3);
    a(3)=2.0*cos(t)+u(1)+u(1)*u(2)+2.0*sin(t)*u(3);

    instead of writing it all out, but I'm not sure how to go about this in Matlab. How would I assign a value to u(2) and u(3)?
    Follow Math Help Forum on Facebook and Google+

  6. #6
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4
    Quote Originally Posted by gummy_ratz View Post
    Ohh okay, thanks. I think I got it working, but I think I'm suppose to have a function like

    function a=f(t,u)
    a=zeros(1,3);a(1)=u(2);
    a(2)=u(3);
    a(3)=2.0*cos(t)+u(1)+u(1)*u(2)+2.0*sin(t)*u(3);

    instead of writing it all out, but I'm not sure how to go about this in Matlab. How would I assign a value to u(2) and u(3)?
    The initial conditions will provide the initial value of the state vector, and that is what you need to start the process, RK will then step forward etc.

    CB
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Runge Kutta on HP50g
    Posted in the Calculators Forum
    Replies: 1
    Last Post: March 9th 2011, 08:52 AM
  2. Runge Kutta (RK4) help
    Posted in the Calculus Forum
    Replies: 5
    Last Post: December 20th 2009, 11:10 AM
  3. Runge Kutta Help
    Posted in the Calculus Forum
    Replies: 0
    Last Post: October 16th 2008, 10:50 PM
  4. Runge-Kutta
    Posted in the Differential Equations Forum
    Replies: 0
    Last Post: May 22nd 2008, 08:54 PM
  5. Runge Kutta
    Posted in the Calculus Forum
    Replies: 0
    Last Post: January 23rd 2008, 11:11 PM

Search Tags


/mathhelpforum @mathhelpforum