Why ode45 can not solve while ode15s can solve?
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Jidapa Adam
el 18 de Mzo. de 2022
Comentada: Steven Lord
el 18 de Mzo. de 2022
My code can solve with ode15s but I would like to try on ode45, So can I use RelTol with value 1e-8 or can you give me other value of RelTol?
P0 = [0.5] ;%bar (Intial pressure)
Ta0 = [873] ;%K (Intial air heat temperature)
repeat = [1] ;%Repeat condition Ta constant and Ta non constant
sheet = 0 ;%Sheet in excel
condition = 0 ;%Number of condition
for a = 1:length(repeat)
for i = 1:length(P0)
for j = 1:length(Ta0)
T0 = Ta0(j) ;%K (Intial temperature before entering bed)
pj0 = yj0.*P0(i) ;%bar (Partial pressure)
Fj0 = (pj0.*v0_feed)./(R_feed.*T0) ;%mol/s (Molar flowrate)
Lspan = [0:0.01:0.03] ;%m (Bed length range)
dep_var0 = [Fj0' T0 Ta0(j)] ;%[mol/s,K,K] (Intial dependent variable)
condition = condition + 1 ;
var = [P0(i) Ta0(j) condition T0] ;%[bar,K,-,K] (Another variable that nessery)
options = odeset('RelTol',1e-3);
[L ,dep_var] = ode45(@func_NiCo,Lspan,dep_var0,options,var) ;
2 comentarios
Walter Roberson
el 18 de Mzo. de 2022
What happened when you tried with ode45?
Note: in order for us to test we would need your func_NiCo as well
Respuesta aceptada
Walter Roberson
el 18 de Mzo. de 2022
You have a "stiff" system of equations. The equations wobble a lot and ode45 has to take very small steps to try to follow the wobbles because they might be important.
4 comentarios
Walter Roberson
el 18 de Mzo. de 2022
Editada: Walter Roberson
el 18 de Mzo. de 2022
You can fix the problem by stopping interrupting ode45 and let it run the several years it needs to calculate the system properly.
(It is not a bug.)
Steven Lord
el 18 de Mzo. de 2022
If you're not familiar with stiffness in ODEs I recommend reading through this post on Cleve Moler's blog. Run at least the one example Cleve recommends running and read his explanation for its performance.
Más respuestas (0)
Ver también
Categorías
Más información sobre Ordinary Differential Equations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!