help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Differential equations - recursive anonymous functions


From: genehacker
Subject: Re: Differential equations - recursive anonymous functions
Date: Mon, 20 Oct 2008 16:50:47 -0700 (PDT)

I didnt put the actual function for g and x4 just for brevity. please
consider that there is an actual function defined there/


genehacker wrote:
> 
> So,
> 
>     I have to tell you this forum is great for octave users who seeks help
> and advise. thanks very much guys.
> 
> So i have this differential equations setup and a couple of recursive
> anonymous functions in there.
> 
> ***********************
> g = @(t,x2,x4);
> x4 = @(t,x2,g);
> x5 = @(x1)   k1max- ((k1max- k1min)/(1 + (f1 * x1/IC2)));
> x6 = @(x1)   k2max- ((k2max- k2min)/(1 + (f1 * x1/IC2)));
> x7 = @(x1)   k23min- ((k23min- k23max)/(1 + (f1 * x1/IC2)));
> 
> xdot = @(x,t) [ ( g * x4 / pre_OC) - x5(x(1)) * x(1);
>                         x6(x(1)) * pre_OB - x7(x(1)) * x(2);
>                       x7(x(1)) * x(2) - k3 * x(3)];
> 
> x = [0,0,0; 0,0,0];
> time = linspace(1,50,51);
> for i=1:length(time)-1
>       seedtime = time(i:i+1);
>       [x,istate,msg] = lsode(xdot,[0 0 0],seedtime);
> endfor
> 
> **************
> so that I can run differential equations step by step to control the
> time-dependent parameterrs g,x4,x5,x6 and x7. The problem Im having is
> because g(x4) and x4(g), how should I write the xdot(1) equation. simply
> doing this gives error
> xdot(1) = g * x4 / pre_OC) - x5(x(1)) * x(1);
> Note that g(0)=0; so system can compute other parameters from it and start
> running.
> 
> How should I write xdot? Also if I want to call these parameters from
> within the for loop at each run, how should I call them?
> 
> thanks a bunch,
> k3.
> 

-- 
View this message in context: 
http://www.nabble.com/Differential-equations---recursive-anonymous-functions-tp20080482p20081076.html
Sent from the Octave - General mailing list archive at Nabble.com.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]