ode45 error: must return a column vector
Mostrar comentarios más antiguos
Hello friends I wrote a code given below, but it give me some errors inclueding "must return a column vector". How could I fix it? The code and errors are given below.
This is my project work due date is tomorrow, so please help me, I need your valuable help
CODE:
clc;
clear all;
mu_Hmax=0.15;
T=22.6;
X_BH=2295;
%
teta=1.25;
Y_H=0.6;
Ks=100;
mu_H=mu_Hmax*(1.072^(T-20));
tm=[30 32 34 36 50 52 57 59 61 63 65 72 75 76 79 83 85 87 89 96 99 106 109 116 118 121 124 125 126 127 131 133 134 135 136 137 140];
%
Sm=[743 585 720 805 571 672 676 574 752 800 535 563 640 800 529 571 588 535 495 641 620 358 515 290 438 356 390 427 483 442 392 429 348 346 356 355 371];
S0 = 1127;
%
Sinr=round(S0*0.5/10)*10:10:round(S0*1.5/10)*10;
tspan=0:140;
%
Ss_in=ones(length(tspan),1)*S0;
res=zeros(length(tm),length(Sinr));
for i=1:length(tm)
%
for j=1:length(Sinr)
Ss_in(tm(i):end)=Sinr(j);
[t Ss]=ode45(@(t,Ss) dynsubstrate(t,Ss,Y_H,Ks,Ss_in),tspan,S0);
res(i,j)=sqrt((Ss(tm(i)+1)-Sm(i))^2);
end
[minres, lmin]=min(res(i,:));
%
Ss_in(tm(i):end)=Sinr(lmin);
end
clear i j
%
Sp=zeros(length(tm),1);
%
for i=1:length(tm)
Sp(i)=Ss(tm(i)+1);
end
clear delta i
delta=-0.25:0.05:0.25;
for i=1:length(delta)
Ksper=Ks+(Ks*delta(i));
[t Ss]=ode45(@(t,Ss) dynsubstrate(t,Ss,Y_H,Ks,Ss_in),tspan,S0);
[t SsKsper]=ode45(@(t,SsKsper) dynsubstrate_Ks(t,Ss,Y_H,Ksper,Ss_in),tspan,S0);
SKsper=abs(((SsKsper-Ss)./Ss).*(Ks./(Ksper-Ks)));
S=max(SKsper(:,1))
end
-----------------------------
ERROR:
Error using odearguments (line 93)
@(T,SSKSPER)DYNSUBSTRATE_KS(T,SS,Y_H,KSPER,SS_IN) must return a column vector.
Error in ode45 (line 115)
odearguments(FcnHandlesUsed, solver_name, ode, tspan, y0, options, varargin);
Error in DYNTP3P3S3Kspert (line 49)
[t SsKsper]=ode45(@(t,SsKsper) dynsubstrate_Ks(t,Ss,Y_H,Ksper,Ss_in),tspan,S0); % % concentration calculation based on Ksper
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Ordinary Differential Equations en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!