Results 1 to 3 of 3

Math Help - Solving IVP in Matlab (ode45)

  1. #1
    Senior Member
    Joined
    Nov 2008
    Posts
    461

    Solving IVP in Matlab (ode45)

    Good day to you!

    I want to solve an IVP in matlab, given by

     x_1 ' (t) = -4*10^{-2} x_1(t) +3*10^7 x_2(t)x_3(t)

    x_2'(t) = 4*10^{-2}-10^{4}x_2(t)x_3(t) - 3*10^7x_2^2(t)

    x_3'(t) = 3*10^7 x_2^2(t)

    I tried to write this as a first order vector

     \dot{x} = \begin{pmatrix} -4*10^{-2} & 3*10^7 & 3*10^7 \\ ... & ...&...\\...&...&...\end{pmatrix}*x

    Because of  x_2(t)x_3(t) (or because of the first line in the matrix) I think this does not work that way.

    Thanks for spending time on my problem/posting.

    Kind regards,
    Rapha
    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 Rapha View Post
    Good day to you!

    I want to solve an IVP in matlab, given by

     x_1 ' (t) = -4*10^{-2} x_1(t) +3*10^7 x_2(t)x_3(t)

    x_2'(t) = 4*10^{-2}-10^{4}x_2(t)x_3(t) - 3*10^7x_2^2(t)

    x_3'(t) = 3*10^7 x_2^2(t)

    I tried to write this as a first order vector

     \dot{x} = \begin{pmatrix} -4*10^{-2} & 3*10^7 & 3*10^7 \\ ... & ...&...\\...&...&...\end{pmatrix}*x

    Because of  x_2(t)x_3(t) (or because of the first line in the matrix) I think this does not work that way.

    Thanks for spending time on my problem/posting.

    Kind regards,
    Rapha
    THis just like the other problem, set up a function with the derivative:

    Code:
    function dx=deriv(t,x)
       dx=zeros(size(x);
       dx(1)=-4*10^(-2)* x(1) +3*10^7 *x(2)*x(3);
       dx(2)=4*10^(-2)-10^(4)*x(2)*x(3) - 3*10^7*x(2);
       dx(3)=3*10^7 *x(2)^2;
    CB
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Senior Member
    Joined
    Nov 2008
    Posts
    461
    Hello CB!

    Quote Originally Posted by CaptainBlack View Post
    THis just like the other problem,
    Wow, you remember that?! Long memory...

    Quote Originally Posted by CaptainBlack View Post
    THis just like the other problem,
    The IVPs are so confusing.

    Quote Originally Posted by CaptainBlack View Post
    set up a function with the derivative:

    Code:
    function dx=deriv(t,x)
       dx=zeros(size(x);
       dx(1)=-4*10^(-2)* x(1) +3*10^7 *x(2)*x(3);
       dx(2)=4*10^(-2)-10^(4)*x(2)*x(3) - 3*10^7*x(2);
       dx(3)=3*10^7 *x(2)^2;
    CB
    Thank you for the code! This helps me to understand the problem.

    Best wishes, Rapha
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. MATLAB ODE45 in a for cycle
    Posted in the Math Software Forum
    Replies: 4
    Last Post: February 17th 2010, 07:07 AM
  2. Quick MATLAB ode45 question
    Posted in the Math Software Forum
    Replies: 3
    Last Post: November 16th 2009, 10:40 PM
  3. Matlab ode45
    Posted in the Math Software Forum
    Replies: 8
    Last Post: October 24th 2009, 11:22 AM
  4. ode45 Matlab
    Posted in the Math Software Forum
    Replies: 6
    Last Post: November 29th 2008, 08:21 PM
  5. ode45 MATLAB
    Posted in the Math Software Forum
    Replies: 2
    Last Post: September 24th 2008, 04:02 AM

Search Tags


/mathhelpforum @mathhelpforum