Finding a specific ode solution
Ältere Kommentare anzeigen
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 Kommentare
Alan Stevens
am 10 Mär. 2021
You pass two parameters to your odefcn, but have it return three!
What are the mathematical equations you are trying to solve?
Kara Scully
am 10 Mär. 2021
Alan Stevens
am 10 Mär. 2021
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?
Antworten (0)
Kategorien
Mehr zu Ordinary Differential Equations finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!