Thread Subject: ode function problem: Unable to meet integration tolerances and RCOND = NaN

Subject: ode function problem: Unable to meet integration tolerances and RCOND = NaN

From: ?nder

Date: 2 Nov, 2009 14:24:03

Message: 1 of 4

Hi,i have a problem with my ode function, it gives these warnings and gives NaN or no solutions:

...
Warning: Matrix is singular, close to singular or badly scaled.
         Results may be inaccurate. RCOND = NaN.
> In ode15s at 617
Warning: Matrix is singular, close to singular or badly scaled.
         Results may be inaccurate. RCOND = NaN.
> In ode15s at 617
Warning: Failure at t=0.000000e+000. Unable to meet integration tolerances without reducing the step size below the smallest value allowed (0.000000e+000) at time t.
> In ode15s at 686
Warning: Divide by zero.
Warning: Divide by zero.


Although i've tried many things, i couldn't make my programme work. What can i do to solve the problem, anyone has a guess?

Subject: ode function problem: Unable to meet integration tolerances and RCOND = NaN

From: ?nder

Date: 7 Nov, 2009 07:21:24

Message: 2 of 4

     Hi,i have a problem with my ode function, it gives these warnings and gives NaN or no solutions:

...
> Warning: Matrix is singular, close to singular or badly scaled.
> Results may be inaccurate. RCOND = NaN.
> > In ode15s at 617
> Warning: Matrix is singular, close to singular or badly scaled.
> Results may be inaccurate. RCOND = NaN.
> > In ode15s at 617
> Warning: Failure at t=0.000000e+000. Unable to meet integration tolerances without reducing the step size below the smallest value allowed (0.000000e+000) at time t.
> > In ode15s at 686
> Warning: Divide by zero.
> Warning: Divide by zero.


    Although i've tried many things, i couldn't make my programme work. What can i do to solve the problem, anyone has a guess?


     My exact programme is as following:

function dy=odefunBR(t,y)
axt=0;
ayt=0;
g=atan(y(6)/y(5)); %gamma angle

K2=10; %Choose a proper 'K2' gain such that 'nc' doesn't exceed 200.
Rm=( y(1)^2+y(2)^2 )^(1/2);
Qt=atan(y(4)/y(3)); Qm=atan(y(2)/y(1));
nc=K2*Rm*sin(Qt-Qm);

dy=zeros(8,1); %create a column vector
dy(1)=y(5);
dy(2)=y(6);
dy(3)=y(7);
dy(4)=y(8);
dy(5)=-nc*sin(g);
dy(6)=nc*cos(g);
dy(7)=axt;
dy(8)=ayt;

%solve 'odefunBR' function, at time interval: 0-10sec, for the initials
[T,Y] = ode15s(@odefunBR,[0 10],[0 0 0 4000 0 500 250 0]);

Subject: ode function problem: Unable to meet integration tolerances and RCOND = NaN

From: ?nder

Date: 7 Nov, 2009 07:24:05

Message: 3 of 4


     Hi,i have a problem with my ode function, it gives these warnings and gives NaN or no solutions:

...
> Warning: Matrix is singular, close to singular or badly scaled.
> Results may be inaccurate. RCOND = NaN.
> > In ode15s at 617
> Warning: Matrix is singular, close to singular or badly scaled.
> Results may be inaccurate. RCOND = NaN.
> > In ode15s at 617
> Warning: Failure at t=0.000000e+000. Unable to meet integration tolerances without reducing the step size below the smallest value allowed (0.000000e+000) at time t.
> > In ode15s at 686
> Warning: Divide by zero.
> Warning: Divide by zero.


     Although i've tried many things, i couldn't make my programme work. What can i do to solve the problem, anyone has a guess?
     My exact code is as follows:

function dy=odefunBR(t,y)
axt=0;
ayt=0;
g=atan(y(6)/y(5)); %gamma angle

K2=10; %Choose a proper 'K2' gain such that 'nc' doesn't exceed 200.
Rm=( y(1)^2+y(2)^2 )^(1/2);
Qt=atan(y(4)/y(3)); Qm=atan(y(2)/y(1));
nc=K2*Rm*sin(Qt-Qm);

dy=zeros(8,1); %create a column vector
dy(1)=y(5);
dy(2)=y(6);
dy(3)=y(7);
dy(4)=y(8);
dy(5)=-nc*sin(g);
dy(6)=nc*cos(g);
dy(7)=axt;
dy(8)=ayt;

[T,Y] = ode15s(@odefunBR,[0 10],[0 0 0 4000 0 500 250 0]);

Subject: ode function problem: Unable to meet integration tolerances and RCOND = NaN

From: Steven Lord

Date: 9 Nov, 2009 00:05:49

Message: 4 of 4


"?nder " <onderbey_@hotmail.com> wrote in message
news:hd375k$ben$1@fred.mathworks.com...
> Hi,i have a problem with my ode function, it gives these warnings and
> gives NaN or no solutions:

*snip*

> Although i've tried many things, i couldn't make my programme work.
> What can i do to solve the problem, anyone has a guess?

*snip*

> My exact programme is as following:
>
> function dy=odefunBR(t,y)

*snip*

> Qt=atan(y(4)/y(3)); Qm=atan(y(2)/y(1));

The first time your function is called with the initial condition y vector:

*snip*

> %solve 'odefunBR' function, at time interval: 0-10sec, for the initials
> [T,Y] = ode15s(@odefunBR,[0 10],[0 0 0 4000 0 500 250 0]);

so Qm is atan(0/0) which is atan(NaN) which is NaN and that propagates
through the rest of the dy vector your function returns. You need to
determine how to fix that based on the problem you're trying to solve.

BTW, from the code it looks like you're calling ODE15S from inside odefunBR,
while specifying that your ODE function is also odefunBR. You shouldn't do
this -- see Q4.15 in the newsgroup FAQ for the reason why you shouldn't do
this and how to avoid it.

--
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
nan Önder Akal?n 7 Nov, 2009 02:24:10
step size Önder Akal?n 7 Nov, 2009 02:24:10
integration tol... Önder Akal?n 7 Nov, 2009 02:24:10
function Önder Akal?n 7 Nov, 2009 02:24:09
ode function Önder Akal?n 2 Nov, 2009 09:29:04
options Önder Akal?n 2 Nov, 2009 09:29:04
odeset Önder Akal?n 2 Nov, 2009 09:29:04
ode Önder Akal?n 2 Nov, 2009 09:29:04
rssFeed for this Thread

Contact us at files@mathworks.com