How do you solve a coupled ODE when one of the ODE results in a vector of length 3 and the other results in a scalar of length 1?
古いコメントを表示
For instance, in the following example that I found online, if dz(2) were actually a vector, how would you modify this?
[v z] = ode45(@myode,[0 500],[0 1]);
function dz = myode(v,z)
alpha = 0.001;
C0 = 0.3;
esp = 2;
k = 0.044;
f0 = 2.5;
dz = zeros(2,1);
dz(1) = k*C0/f0*(1-z(1)).*z(2)./(1-esp*z(1));
dz(2) = -alpha*(1+esp*z(1))./(2*z(2));
end
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Programming についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

