Unable to meet integration tolerances.
Show older comments
Recently I wrote a program about a Non-autonomous ODE system as follow
++++++++
options = odeset('RelTol',1e-4,'AbsTol',1e-4);
[t x]=ode45(@function,0:2*pi/100:400,[1e+4 500 1000],options);
function xdot=function(t,x)
xdot(1)=(1e+6)-0.02*x(1)-((3.5e-5)+(2e-5)*cos(2*pi*t))*x(1)*x(3);
xdot(2)=((3.5e-5)+(2e-5)*cos(2*pi*t))*x(1)*x(3)-(0.02+45.6)*x(2);
xdot(3)=45.6*x(2)-73.02*x(3);
xdot=xdot';
end
++++++++
However, when I run it, the Program always show error information as follows
-------------
Warning: Failure at t=4.401339e+000. Unable to meet integration tolerances without reducing the step size below the smallest value allowed (1.421085e-014) at time t.
> In ode45 at 355 In measles2attractor at 19 Warning: Imaginary parts of complex X and/or Y arguments ignored.
> In measles2attractor at 21
I will be very appreciate if someone could tell me What is wrong and How to modify the code!
Answers (1)
Sean de Wolski
on 13 Dec 2011
iskeyword function
ans = 1
I'm surprised it even let you call it that way. You cannont name a function function since it's reserved for the definition of functions. Rename it to fun (both at the top of the file and the *.m file name) or something desciptive about what it does and see if the error remains.
2 Comments
lan yuntian
on 14 Dec 2011
Sean de Wolski
on 14 Dec 2011
Update your question with the _actual_ function names and code to help us eliminate guesswork.
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!