Error ode must return column vector
Show older comments
function diffeq = ode(w, v)
k1 = 0.5*exp(2-640/v(4));
Kc = 10*exp(2064/v(4)-7.2);
k3 = 0.005*exp(4.6-2116/v(4));
Ta = 500;
Ua_rho = 16;
Cpa =100;
Cpb =100;
Cpc =100;
deltaH1=-1800;
FC = v(1)*Cpa +v(2)*Cpb + v(3)*Cpc;
diffeq(1)=k1*v(2)-k1/Kc*v(1);
diffeq(2)=k1/Kc*v(1)-v(2)*(k1+k3);
diffeq(3)=k3*v(2);
diffeq(4)=((k1/Kc*v(1)-v(2)*(k1+k3))*deltaH1 - Ua_rho*(v(4)-Ta))/FC;
====
wspan = [0 100];
IC(1)=1; IC(2)=1; IC(3)=0; IC(4)=330;
[w,vv] = ode15s(@ode,wspan,IC);
Fa = vv(:,1); Fb = vv(:,2); Fc = vv(:,3); T = vv(:,4);
plot(w,Fa, w,Fb, w,Fc, w,T)
xlabel('weight of catalyst')
ylabel('Flow Rates and Temp')
Error using odearguments (line 93)
ODE must return a column vector.
Error in ode15s (line 150)
odearguments(FcnHandlesUsed, solver_name, ode, tspan, y0, options, varargin);
Error in odesolve (line 5)
[w,vv] = ode15s(@ode,wspan,IC);
It says my ode needs to return a column, but my ode if im not mistaken is a 4by4 matrix so I don't understand how is it no a column vector?
Accepted Answer
More Answers (1)
Walter Roberson
on 19 Oct 2017
0 votes
A column vector has to be something-by-1 . A 4 x 4 is not a vector. You need to return 16 x 1.
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!