MATLAB Answers

I am receiving the error message Index exceeds the number of array elements (1) when trying to use ode45.

9 views (last 30 days)
Michael Gomez
Michael Gomez on 30 Nov 2019
Answered: darova on 30 Nov 2019
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 Comments

Sign in to comment.

More Answers (0)

Sign in to answer this question.