Matlab ode solvers - adding a separate convergence criteria

In summary, a convergence criteria is a condition used to determine when an iterative process, such as solving an ODE, has reached a satisfactory solution. In Matlab ode solvers, it is used to specify the accuracy or tolerance level of the solution. To add a separate convergence criteria, the <code>odeset</code> function can be used to create an options structure with the <code>RelTol</code> and <code>AbsTol</code> options. Multiple convergence criteria can be used by specifying different values for each component of the solution. If the convergence criteria is not met, the solver will continue to iterate until the maximum number of iterations is reached, and if a solution still cannot be found, an error
  • #1
hoomanya
90
0
Hi, is there a way to add a user defined convergence criteria to an ode solver so that the solution is stopped?
 
Physics news on Phys.org
  • #2
You can write an event function that is passed to the solver in the options structure (which you create using odeset). More info here:

http://www.mathworks.com/help/matlab/ref/odeset.html#f92-1017470

For a simple example, type

Code:
edit ballode

If you mark an event as terminal, then the solver stops when that event is hit.
 

1. What is a convergence criteria in Matlab ode solvers?

A convergence criteria is a condition that is used to determine when an iterative process, such as solving an ODE, has reached a satisfactory solution. In Matlab ode solvers, it is used to specify the accuracy or tolerance level of the solution.

2. How can I add a separate convergence criteria in Matlab ode solvers?

To add a separate convergence criteria in Matlab ode solvers, you can use the odeset function to create an options structure. Within this structure, you can specify the convergence criteria using the RelTol and AbsTol options. These values will be used to determine the accuracy of the solution.

3. Can I use multiple convergence criteria in Matlab ode solvers?

Yes, you can use multiple convergence criteria in Matlab ode solvers by specifying different RelTol and AbsTol values for different components of the solution. This can be useful when solving systems of ODEs with different levels of accuracy needed for each component.

4. What happens if the convergence criteria is not met in Matlab ode solvers?

If the convergence criteria is not met in Matlab ode solvers, the solver will continue to iterate until the maximum number of iterations is reached. If the solution still does not meet the convergence criteria, an error message will be returned, indicating that the solver was unable to find a satisfactory solution.

5. How do I choose appropriate convergence criteria values in Matlab ode solvers?

Choosing appropriate convergence criteria values in Matlab ode solvers depends on the specific problem you are trying to solve. Generally, the values should be small enough to ensure an accurate solution, but not so small that the solver takes an excessively long time to converge. It is recommended to experiment with different values to find the optimal balance between accuracy and efficiency for your specific problem.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
6K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
Replies
9
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
Replies
3
Views
1K
Back
Top