From: John G on 24 May 2010 09:43 Hi, I need to solve a system of three ODE's; dC1/dt=-r1 dC2/dt=r1-r2 dC3/dt=-r2 where; r1=r1=(k1*K1*K2*Cc*C1*Cco*Ch2)/(1+K1*Cco++K1*K2*Cco*C1+K1*K2*K3*Cco^2*C1+K1*K2*K3*K4*Cco^3*C1) r2=k2 and k1,k2,K1,K2,K3,K4,Cc are constants. I have tried to do this wit standard routine for solving system of ODE's by defining a vector for variables, but this is not leading to the solution. I am interested only in C1,C2 and C3 but I don't know how to include Cco and Ch2? I would be very grateful for any kind of support. function dC_dt=figure1(t,C) global k1 k2 K1 K2 K3 K4 Ccat r1=(k1*K1*K2*Ccat*C(1)*C(4)*C(5))/(1+K1*C(5)+K1*K2*C(5)*C(1)+K1*K2*K3*C(5)^2*C(1)+K1*K2*K3*K4*C(5)^3*C(1)); r2=k2; dC_dt(1)=r1; dC_dt(2)=r1-r2; dC_dt(3)=r2; dC_dt(4)=0; dC_dt(5)=0; dC_dt=[dC_dt(1);dC_dt(2);dC_dt(3)]; end global k1 k2 K1 K2 K3 K4 Ccat Ccat=1.25; k1=3.61; k2=2.3; K1=5.46e2; K2=2.5; K3=16.66; K4=7.41e-2; cdab0=0.447; c20=0; c30=0; cco0=1.209; ch20=1.209; c0(1)=cdab0; c0(2)=c20; c0(3)=c30; c0(4)=cco0; c0(5)=ch20; [t,c]=ode45('figure1',[0 1],[c0(1) c0(2) c0(3) c0(4) c0(5)]); c1=c(:,1); c2=c(:,2); c3=c(:,3);
From: Steven Lord on 24 May 2010 10:13 "John G" <sinrem(a)gmail.com> wrote in message news:htdvp9$9p$1(a)fred.mathworks.com... > Hi, > > I need to solve a system of three ODE's; *snip* > I have tried to do this wit standard routine for solving system of ODE's > by defining a vector for variables, but this is not leading to the > solution. I am interested only in C1,C2 and C3 but I don't know how to > include Cco and Ch2? Use the technique described here: http://www.mathworks.com/access/helpdesk/help/techdoc/math/f1-662913.html#brfharp-9 or use an anonymous function. R = 5; ode45(@(t, y) myOdeFunctionRequiringR(t, y, R), ...) -- Steve Lord slord(a)mathworks.com comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ To contact Technical Support use the Contact Us link on http://www.mathworks.com
|
Pages: 1 Prev: How to detect a new coming image Next: Indexing, (:) and var |