ODE45 Integration tolerances...
显示 更早的评论
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!
回答(1 个)
Star Strider
2017-12-23
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')
类别
在 帮助中心 和 File Exchange 中查找有关 Ordinary Differential Equations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!