Path: news.mathworks.com!not-for-mail
From: "Steven Lord" <slord@mathworks.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: ode function problem: Unable to meet integration tolerances and RCOND = NaN
Date: Sun, 8 Nov 2009 19:05:49 -0500
Organization: The MathWorks, Inc.
Lines: 43
Message-ID: <hd7mb2$4gu$1@fred.mathworks.com>
References: <hcmq23$m6j$1@fred.mathworks.com> <hd375k$ben$1@fred.mathworks.com>
Reply-To: "Steven Lord" <slord@mathworks.com>
NNTP-Posting-Host: lords.dhcp.mathworks.com
X-Trace: fred.mathworks.com 1257725090 4638 172.31.44.65 (9 Nov 2009 00:04:50 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 9 Nov 2009 00:04:50 +0000 (UTC)
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
Xref: news.mathworks.com comp.soft-sys.matlab:583442



"?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