Solving differential equations with Ode15s
이전 댓글 표시
Hello, I have the following system:
CSTR in gaseous phase, transient conditions and N components. For each component i the mass balance is:
dCi/dt=1/V (QeCi,e-QsCi,s )+γi r
where V is the volume of the reactor, Qe and Qs are the volumetric flowrates of the inlet and outlet respectively, Ci,e and Ci,s are the inlet and outlet concentrations of component i, and r is the rate of the reaction that takes place.
However Qs is unknown so I summed up all the equations above and got this:
Qs =Qe*(1/∑i Ci,s)*(∑i Ci,e -V/Qe ∑i dCi/dt -V/Qe ∑i γir)
I need to solve this set of equations, where Qe and Ci,e vary with time.
I defined the equations above in a function dydt=function(t,y,Ce,Qe,tspan) so I have N differential equations + equation Qs. I want to solve this set. I would also like to know Qs and not just the concentrations.
I use interp1 to have access to Ce and Qe values for each t. I defined the initial condition y0 where all values are zero except one of them (there is only one component entering the reactor).
I use [t,y]=ode15s(@(t,y)function(t,y,Ce,Qe,tspan),tspan,y0);
However I get a warning: Warning: Matrix is singular, close to singular or badly scaled. Results may be inaccurate. RCOND = NaN.
I don't know why I get this error. Is my method correct and is it possible to have Qs as an output of the function?
댓글 수: 2
Torsten
2018년 3월 23일
Qs can't be determined by adding up the equations, but only by an additional independent condition, e.g. that the volume remains constant or the pressure remains constant or something similar.
Best wishes
Torsten.
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!