ODE45 Integration tolerances...
Show older comments
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!
Answers (1)
Star Strider
on 23 Dec 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')
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!