I am receiving the error message Index exceeds the number of array elements (1) when trying to use ode45.
2 次查看(过去 30 天)
显示 更早的评论
I am attempting to produce a solution to a system of ODE's that model a PFR. When the function is run it gives the error Index exceeds the number of array elements (1). The number of differential equations and the number of initial conditions match so I do not understand why this error is occurring.
tspan=[0 8.41*10^-4];
y0=[300;293;.5;0];
k1=0.01;
kc=10;
hrx=-6000;
cps=30;
U=117.1793294;
Fa0=.35;
T0=300;
Tc0=293;
E=10000;
A=0.02142857143;
R=1.98720425864083;
[T,V]=ode45(@(T,V) [(k1*(exp((-E/R)*(T(1)-T0)))*(T(3)*T(3)-T(4)/kc)*(-hrx)-U*A*(T(1)-T(2))/(Fa0*cps));(U*A*(T(2)-T(1)))/(10^-3*.7*882*1900);k1*(exp((-E/R)*(T(1)-T0)))*(T(3)*T(3)-T(4)/kc);-k1*(exp((-E/R)*(T(1)-T0)))*(T(3)*T(3)-T(4)/kc)],tspan,y0);
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
类别
在 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!