steady state criterion
Show older comments
Hi, I have a system of 4 ODE's and I solved it by using ode15s solver. But I want to stop simulations when the steady state is reached. Can someone tell me how to do it? I need to know this urgent!! Thanks and regards.
1 Comment
Hello,
I do have a similar set of ODE's which solves a chemical kinetics system. I am using some constraints to solve these equations and I am able to solve for few set of unknowns. However when I use more unknowns (~8) with 2 constraints to solve for rest 6 unknowns using ODE, I see the problem will not be solved till the final time. For e.g., I have specified initial time and final time as [t0 tf] which i pass to the ODE15s solver. So for the higher number of unknowns, the ODE solver will not solve until 'tf' has achieved (not blowing up as well). Can anyone help me why ODE solves only to a fraction of final time 'tf'? And also tell me how to fix this? I have seen events being used to stop the code when steady state achieved. I want something reverse. I want to know why the ODE solver do not finishes till the specified time!!
Accepted Answer
More Answers (1)
Laura Proctor
on 6 Apr 2011
You can set the error tolerance of the ODE solver using the function ODESET and then pass in the structure created from ODESET into your ODE solver.
For example:
options = odeset('RelTol',1e-2,'AbsTol',[1e-3,1e-3,1e-4,1e-2]);
[T,Y] = ode15s(@myFcn,t,y0,options);
Try this out to see if you're able to get better results.
You may also be interested in event handling, which is where you can make your simulation stop once an event happens (such as when the output goes below a specific value). You also do this using ODESET function - look at the topic Event Location Property in the documentation for ODESET for more details on this.
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!