ODE45 Integration tolerances...
Afficher commentaires plus anciens
Very simple use of ode45 trying to solve dy/dt = -y+y^2
My code is:
y0=2;
t=linspace(0,3,100);
func=@(t,y) -y+y.^2;
[t,y] = ode45 (func, t, y0);
Keep getting "Warning: Failure at t=6.93...e-01 Unable to meet integration tolerances without reducing step size.
Thanks in Advance!
Réponses (1)
Star Strider
le 23 Déc 2017
The derivative increases significantly at t=6.931342e-01, so the solver cannot provide results with acceptable floating-point accuracy without reducing the adaptive time step size below the smallest value allowed (1.776357e-15).
It is a warning, not an error.
To see the reason, add this after your ode45 call:
figure(1)
plot(t, y, t, func(t,y))
legend('y(t)', 'dy(t)/dt', 'Location','N')
Catégories
En savoir plus sur Ordinary Differential Equations dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!