I am receiving the error message Index exceeds the number of array elements (1) when trying to use ode45.
Show older comments
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);
Accepted Answer
More Answers (0)
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!