Results 1 to 5 of 5

Math Help - Matlab M file

  1. #1
    Junior Member
    Joined
    Apr 2009
    Posts
    45

    Matlab M file

    Hi, i have a question about this M file, wondering if anyone could help me:

    function dx=gfb(t,x);
    dx=zeros(size(x));
    u = (0.177*x(2)/(0.005+x(2)));
    f = (3000*19.5*exp(u*t)/(630*0.42));
    v = (3000+f);
    dx(1)=u*x(1) - (f*x(1))/v;
    dx(2)=(f*630)/v - (u*x(1))/0.42;


    Does anyone know if by setting it up like this, with f as defined sepratly, will it still be intergrated, as it has a t (time) term in it.

    also is there a way to plot f and u against time also?

    Appreciate any help,

    Rem
    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 rem88 View Post
    Hi, i have a question about this M file, wondering if anyone could help me:

    function dx=gfb(t,x);
    dx=zeros(size(x));
    u = (0.177*x(2)/(0.005+x(2)));
    f = (3000*19.5*exp(u*t)/(630*0.42));
    v = (3000+f);
    dx(1)=u*x(1) - (f*x(1))/v;
    dx(2)=(f*630)/v - (u*x(1))/0.42;


    Does anyone know if by setting it up like this, with f as defined sepratly, will it still be intergrated, as it has a t (time) term in it.

    also is there a way to plot f and u against time also?

    Appreciate any help,

    Rem
    That should work.

    To plot f and u against time get the solution then recalculate them using the t, x(1), and x(2) data that is returned and plot.

    CB
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Junior Member
    Joined
    Apr 2009
    Posts
    45
    Iv done that, thanks.

    I just have one more question.

    I want to put f (once it has been intergrated) in as

    f = 0.0793t + 13.651

    so i have to put it in as df/dt which will be

    f = 0.0793

    so when matlab intergrates this it becomes

    f = 0.0793t + 0

    + 0 becuase the intial condition for t is 0

    is ther away i can put f in where either it doesn intergrate it or it gives

    f = 0.0793t + 13.651

    Sorry if im not clear

    Rem
    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 rem88 View Post
    Iv done that, thanks.

    I just have one more question.

    I want to put f (once it has been intergrated) in as

    f = 0.0793t + 13.651

    so i have to put it in as df/dt which will be

    f = 0.0793

    so when matlab intergrates this it becomes

    f = 0.0793t + 0

    + 0 becuase the intial condition for t is 0

    is ther away i can put f in where either it doesn intergrate it or it gives

    f = 0.0793t + 13.651

    Sorry if im not clear

    Rem
    The initial condition for f should be 13.651

    CB
    Follow Math Help Forum on Facebook and Google+

  5. #5
    Junior Member
    Joined
    Apr 2009
    Posts
    45
    is there a way to put f in as an initial condition?

    because i thought seeting t0 as that would do it, but i need to as 0.

    Rem
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. My Matlab function M-file for the Secant Method
    Posted in the Math Software Forum
    Replies: 4
    Last Post: December 3rd 2010, 07:48 AM
  2. MATLAB: Loading a file and digits
    Posted in the Math Software Forum
    Replies: 2
    Last Post: May 20th 2010, 09:55 AM
  3. Matlab Help: Creating M-File
    Posted in the Math Software Forum
    Replies: 2
    Last Post: March 24th 2010, 09:12 PM
  4. templates file matlab
    Posted in the Math Software Forum
    Replies: 0
    Last Post: January 22nd 2010, 11:29 PM
  5. Need help with fsolve in Matlab M file
    Posted in the Math Software Forum
    Replies: 0
    Last Post: June 6th 2009, 04:06 PM

Search Tags


/mathhelpforum @mathhelpforum