# Matlab M file

• Apr 16th 2009, 01:47 AM
rem88
Matlab M file

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
• Apr 16th 2009, 02:56 AM
CaptainBlack
Quote:

Originally Posted by rem88

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
• Apr 17th 2009, 09:35 AM
rem88
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
• Apr 17th 2009, 11:20 AM
CaptainBlack
Quote:

Originally Posted by rem88
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
• Apr 18th 2009, 03:34 AM
rem88
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