Finding a specific ode solution
古いコメントを表示
Hello! I am trying to solve an ode given starting data and some of the final data, how would I get it to display the time and the y matrix given that y(1) final should be 1e6?
clc; clear;
t = linspace(0,1e7);
C0 = [1e-9,2e6]; %initial concentrations, Z close to zero
%y(1) = Z y(2) = H
%want the time and other concentrations when H=1e6
[t,y] = ode45(@odefcn,t,C0);
function dydt = odefcn(t,y) %y=Cj
kj = [5e-7,4.7e-7];
r = [kj(1)*y(1)*y(2);kj(2)*y(1)*y(2)];
stoictransposed = [1 -1 ;
-1 0 ;
0 1 ];
Rj = stoictransposed*r;
dydt=[Rj];
end
3 件のコメント
Alan Stevens
2021 年 3 月 10 日
You pass two parameters to your odefcn, but have it return three!
What are the mathematical equations you are trying to solve?
Kara Scully
2021 年 3 月 10 日
Alan Stevens
2021 年 3 月 10 日
If you make the first term of stoictransposed 1.44 instead of 1, then y(1) ends up at 10^6. However, this is quite arbitrary. Can you explain more about the underlying system that is being modelled?
回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Ordinary Differential Equations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!