MATLAB Answers

Unable to meet integration tolerances without reducing the step size below the smallest value allowed

5 views (last 30 days)
AM
AM on 25 May 2021
Answered: Chidvi Modala on 31 May 2021
Hello,
I am integrating a series of ODEs and I run into the following warning that stops the integration:
Warning: Failure at t=3.252486e+02. Unable to meet integration tolerances without reducing the step size below the smallest value allowed (9.094947e-13) at time t.
I googled the problem and from what I read I see it could be do to a singularity or discontinuity and it was advised to plot the solution, which I did (see Figure, plotted from 290 to the end of the integration for visibility). I still can't pinpoint what the problem is exactly and how to solve it. I'm guessing it's related to the fact that at time 300 there is a significant change in the values of the variables, as for example the variable in blue here goes from 0 to 0.9 in 3s. However the warning occurs 25s later where the values seem to have stabilized.
Any help is appreciated, thank you

Answers (1)

Chidvi Modala
Chidvi Modala on 31 May 2021
It is useful to set the absolute and relative tolerances to a higher value to avoid this warning. In case of sharp discontinuities in the reference input such as when tracking a reference signal, it is possible that this warning is generated at intermediate time steps. MATLAB is trying to reduce the time step to a really small amount in order to counter the abrupt change due to the discontinuity in the reference signal.
For sharp discontinuities,it might not be possible to avoid this warning. However for non discontinous inputs we can set relative and absolute tolerance to a higher number than the default setting.
We can set the tolerances to a higher value for example by using the following commands:
options = odeset('Mass',M,'RelTol',1e-4,'AbsTol',1e-6);
[t,y] = ode15s(@objectivefunction,tspan,y0,options);
For more information on relative and absolute tolerance you can look at the link below:

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!