ode15s error line 150

4 ビュー (過去 30 日間)
Aimi Oguri
Aimi Oguri 2019 年 9 月 23 日
回答済み: Star Strider 2019 年 9 月 23 日
function [ydot, yinit, option] = Koo1( t , y , flag )
switch flag
case ''
Cab=y(1);
Caex=y(2);
Cas=y(3);
Cac=y(4);
IP3=y(5);
RT = 4.4*10^4;
k1 = 6.0*10^-4;
k2 = 1;
k3 = 3.32;
k4 = 2500;
k5 = 5.0*10^-11;
k6 = 0.05;
k7 = 150;
K1 = 0;
K2 = 200;
K3 = 150;
K4 = 80;
K5 = 321;
Khi = 380;
kCICR = 1;
KCICR = 0;
kCCE = 0;
BT = 1.2*10^5;
Ca0 = 100;
Qshear = 3000;
Vp = 815;
Vex = 9165;
Vhi = 2380;
tau1 = 66;
tau2 = 0.01;
fracK = 7.07*10^6;
v1 = k7 * Cab - k6 * Cac * (BT - Cab);
v2 = kCCE * (((fracK * Ca0)/(K3 + Ca0)) - Cas) * (Caex - Cas);
v3 = k1*(RT - (RT/2) * (exp(-t/tau1) + exp(-t/tau2) + ((exp(-t/tau1) - exp(-t/tau2)) * (tau1 + tau2) / (tau1 - tau2)))) * (exp(-t/tau1) -exp(-t/tau2)) * (Cac / (K1 + Cac));
v4 = k2 * IP3;
v5 = k3 * (kCICR * Cac / (KCICR + Cac)) * (IP3 / (K2 + IP3))^3 * Cas - k4 * (Cac/(K3 + Cac))^2 + k5 * Cas^2;
v6 = Vex * Cac / (K5 + Cac);
v7a = Vp * Cac^2 / ( K4^2 + Cac^2);
v7b= Vhi * Cac^4/( Khi^4 + Cac^4);
v8 = Qshear;
ydot = [- v1;
- v2 + v6 + v7a - v7b;
v2 - v5;
v1 + v5 + v8 - v6 -v7a -v7b;
v3 -v4];
case 'init'
ydot = 0:1:900;
yinit = [ 3870; 1.5*10^6; 2.83*10^6; 117.2; 0];
option = odeset('RelTol',1.0e-7);
end
Errors:
>> [t,y] = ode15s( 'Koo1');
エラー: vertcat
連結する配列の次元が一致しません。
エラー: Koo1 (line 48)
ydot = [- v1;
エラー: odearguments (line 90)
f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.
エラー: ode15s (line 150)
odearguments(FcnHandlesUsed, solver_name, ode, tspan, y0, options, varargin);

採用された回答

Star Strider
Star Strider 2019 年 9 月 23 日
The problem is ‘ydot’. It must be a column vector, and the spaces are causing MATLAB to consider it a matrix. The easiest way to deal with that is simply to put parentheses around each element:
ydot = [(- v1);
(- v2 + v6 + v7a - v7b);
(v2 - v5);
(v1 + v5 + v8 - v6 -v7a -v7b);
(v3 -v4)];
That worked when I tested it.
Also, for that same reason, this is not going to work:
ydot = 0:1:900;
You need to figure out some way of doing what you want with that in the context of the necessity that ‘ydot’ be a column vector.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeNumerical Integration and Differential Equations についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by