I doubt the problem is with massbalance. The ode45 function takes at most four arguments, your function (that you refer to correctly), then a two or more element time vector (tspan), a vector of your initial conditions (a (4x1) vector here), and an options structure if you want to change the default options for ode45. You gave ode45 six arguments, only the first of which (your ODE function call) looks correct.
Ode45 - Too many input arguments.
1 次查看(过去 30 天)
显示 更早的评论
Hello, I am trying to run an ode45, but I get the error:
Error using VanDerVusse_process>@(t,x)massbalanceA(t) Too many input arguments.
The code is:
[t,x]=ode45(@(t,x) massbalanceA(t,x,Cai,Fin,Tin,Qk,tin),tin,Ca,Cb,T,Tk);
The function massbalanceA is:
function[dx]=massbalanceA(t,x,Cai,Fin,Tin,Qk,tin)
global E1 E2 E3 k10 k20 k30 kw Cp Cpk deltaH1 deltaH2 deltaH3 dens mk Ar Vr
Ca=x(1);
Cb=x(2);
T=x(3);
Tk=x(4);
Fin=interp1(tin,Fin,t);
Cai=interp1(tin,Cai,t);
Tin=interp1(tin,Tin,t);
Qk=interp1(tin,Qk,t);
k1=k10*exp(E1/T);
k2=k20*exp(E2/T);
k3=k30*exp(E3/T);
dCa=Fin./Vr.*(Cai-Ca)-k1.*Ca-k3.*Ca.^2;
dCb=-Fin./Vr.*Cb+k1.*Ca-k2.*Cb;
dT=Fin./Vr.*(Tin-T)+kw.*Ar./(dens.*Cp.*Vr).*(Tk-T)-1/(dens.*Cp).*(k1.*Ca.*deltaH1+k2.*Cb.*deltaH2+k3.*Ca.^2.*deltaH3);
dTk=Qk./(mk.*Cpk)+kw.*Ar/(mk.*Cpk).*(T-Tk);
dx=[dCa;dCb;dT;dTk];
end
Thank you for your attention.
0 个评论
回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Ordinary Differential Equations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!