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 个评论

You pass two parameters to your odefcn, but have it return three!
What are the mathematical equations you are trying to solve?
i forgot another initial parameter, it is just very close to zero too like the first element in C0
I know how to plot this but do not know how to output the solution i need, i can get close by selecting a point on the graph but cannot get very accurate that way as it is not the exact number i need. Is there a command that would allow me to plug in one parameter into this solution that would then give the other parameters?
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 个)

类别

Community Treasure Hunt

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

Start Hunting!

Translated by