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!