<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/264755</link>
    <title>MATLAB Central Newsreader - ode function problem: Unable to meet integration tolerances and RCOND = NaN</title>
    <description>Feed for thread: ode function problem: Unable to meet integration tolerances and RCOND = NaN</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Mon, 02 Nov 2009 14:24:03 -0500</pubDate>
      <title>ode function problem: Unable to meet integration tolerances and RCOND = NaN</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/264755#691504</link>
      <author>?nder </author>
      <description>Hi,i have a problem with my ode function, it gives these warnings and gives NaN or no solutions:&lt;br&gt;
&lt;br&gt;
...&lt;br&gt;
Warning: Matrix is singular, close to singular or badly scaled.&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Results may be inaccurate. RCOND = NaN.&lt;br&gt;
&amp;gt; In ode15s at 617&lt;br&gt;
Warning: Matrix is singular, close to singular or badly scaled.&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Results may be inaccurate. RCOND = NaN.&lt;br&gt;
&amp;gt; In ode15s at 617&lt;br&gt;
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.&lt;br&gt;
&amp;gt; In ode15s at 686&lt;br&gt;
Warning: Divide by zero.&lt;br&gt;
Warning: Divide by zero.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
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?</description>
    </item>
    <item>
      <pubDate>Sat, 07 Nov 2009 07:21:24 -0500</pubDate>
      <title>ode function problem: Unable to meet integration tolerances and RCOND = NaN</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/264755#692852</link>
      <author>?nder </author>
      <description>&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Hi,i have a problem with my ode function, it gives these warnings and gives NaN or no solutions:&lt;br&gt;
&lt;br&gt;
...&lt;br&gt;
&amp;gt; Warning: Matrix is singular, close to singular or badly scaled.&lt;br&gt;
&amp;gt;          Results may be inaccurate. RCOND = NaN.&lt;br&gt;
&amp;gt; &amp;gt; In ode15s at 617&lt;br&gt;
&amp;gt; Warning: Matrix is singular, close to singular or badly scaled.&lt;br&gt;
&amp;gt;          Results may be inaccurate. RCOND = NaN.&lt;br&gt;
&amp;gt; &amp;gt; In ode15s at 617&lt;br&gt;
&amp;gt; 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.&lt;br&gt;
&amp;gt; &amp;gt; In ode15s at 686&lt;br&gt;
&amp;gt; Warning: Divide by zero.&lt;br&gt;
&amp;gt; Warning: Divide by zero.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;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?&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;My exact programme is as following:&lt;br&gt;
&lt;br&gt;
function dy=odefunBR(t,y)&lt;br&gt;
axt=0;&lt;br&gt;
ayt=0;&lt;br&gt;
g=atan(y(6)/y(5)); %gamma angle&lt;br&gt;
&lt;br&gt;
K2=10;  %Choose a proper 'K2' gain such that 'nc' doesn't exceed 200.&lt;br&gt;
Rm=( y(1)^2+y(2)^2 )^(1/2);&lt;br&gt;
Qt=atan(y(4)/y(3)); Qm=atan(y(2)/y(1));&lt;br&gt;
nc=K2*Rm*sin(Qt-Qm);&lt;br&gt;
&lt;br&gt;
dy=zeros(8,1); %create a column vector&lt;br&gt;
dy(1)=y(5);&lt;br&gt;
dy(2)=y(6);&lt;br&gt;
dy(3)=y(7);&lt;br&gt;
dy(4)=y(8);&lt;br&gt;
dy(5)=-nc*sin(g);&lt;br&gt;
dy(6)=nc*cos(g);&lt;br&gt;
dy(7)=axt;&lt;br&gt;
dy(8)=ayt;&lt;br&gt;
&lt;br&gt;
%solve 'odefunBR' function, at time interval: 0-10sec, for the initials&lt;br&gt;
[T,Y] = ode15s(@odefunBR,[0 10],[0 0 0 4000 0 500 250 0]);</description>
    </item>
    <item>
      <pubDate>Sat, 07 Nov 2009 07:24:05 -0500</pubDate>
      <title>Re: ode function problem: Unable to meet integration tolerances and RCOND = NaN</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/264755#692853</link>
      <author>?nder </author>
      <description>&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Hi,i have a problem with my ode function, it gives these warnings and gives NaN or no solutions:&lt;br&gt;
&lt;br&gt;
...&lt;br&gt;
&amp;gt; Warning: Matrix is singular, close to singular or badly scaled.&lt;br&gt;
&amp;gt;          Results may be inaccurate. RCOND = NaN.&lt;br&gt;
&amp;gt; &amp;gt; In ode15s at 617&lt;br&gt;
&amp;gt; Warning: Matrix is singular, close to singular or badly scaled.&lt;br&gt;
&amp;gt;          Results may be inaccurate. RCOND = NaN.&lt;br&gt;
&amp;gt; &amp;gt; In ode15s at 617&lt;br&gt;
&amp;gt; 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.&lt;br&gt;
&amp;gt; &amp;gt; In ode15s at 686&lt;br&gt;
&amp;gt; Warning: Divide by zero.&lt;br&gt;
&amp;gt; Warning: Divide by zero.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;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?&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;My exact code is as follows:&lt;br&gt;
&lt;br&gt;
function dy=odefunBR(t,y)&lt;br&gt;
axt=0;&lt;br&gt;
ayt=0;&lt;br&gt;
g=atan(y(6)/y(5)); %gamma angle&lt;br&gt;
&lt;br&gt;
K2=10;  %Choose a proper 'K2' gain such that 'nc' doesn't exceed 200.&lt;br&gt;
Rm=( y(1)^2+y(2)^2 )^(1/2);&lt;br&gt;
Qt=atan(y(4)/y(3)); Qm=atan(y(2)/y(1));&lt;br&gt;
nc=K2*Rm*sin(Qt-Qm);&lt;br&gt;
&lt;br&gt;
dy=zeros(8,1); %create a column vector&lt;br&gt;
dy(1)=y(5);&lt;br&gt;
dy(2)=y(6);&lt;br&gt;
dy(3)=y(7);&lt;br&gt;
dy(4)=y(8);&lt;br&gt;
dy(5)=-nc*sin(g);&lt;br&gt;
dy(6)=nc*cos(g);&lt;br&gt;
dy(7)=axt;&lt;br&gt;
dy(8)=ayt;&lt;br&gt;
&lt;br&gt;
[T,Y] = ode15s(@odefunBR,[0 10],[0 0 0 4000 0 500 250 0]);</description>
    </item>
    <item>
      <pubDate>Mon, 09 Nov 2009 00:05:49 -0500</pubDate>
      <title>Re: ode function problem: Unable to meet integration tolerances and RCOND = NaN</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/264755#693108</link>
      <author>Steven Lord</author>
      <description>&lt;br&gt;
&quot;?nder &quot; &amp;lt;onderbey_@hotmail.com&amp;gt; wrote in message &lt;br&gt;
news:hd375k$ben$1@fred.mathworks.com...&lt;br&gt;
&amp;gt;     Hi,i have a problem with my ode function, it gives these warnings and &lt;br&gt;
&amp;gt; gives NaN or no solutions:&lt;br&gt;
&lt;br&gt;
*snip*&lt;br&gt;
&lt;br&gt;
&amp;gt;    Although i've tried many things, i couldn't make my programme work. &lt;br&gt;
&amp;gt; What can i do to solve the problem, anyone has a guess?&lt;br&gt;
&lt;br&gt;
*snip*&lt;br&gt;
&lt;br&gt;
&amp;gt;     My exact programme is as following:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; function dy=odefunBR(t,y)&lt;br&gt;
&lt;br&gt;
*snip*&lt;br&gt;
&lt;br&gt;
&amp;gt; Qt=atan(y(4)/y(3)); Qm=atan(y(2)/y(1));&lt;br&gt;
&lt;br&gt;
The first time your function is called with the initial condition y vector:&lt;br&gt;
&lt;br&gt;
*snip*&lt;br&gt;
&lt;br&gt;
&amp;gt; %solve 'odefunBR' function, at time interval: 0-10sec, for the initials&lt;br&gt;
&amp;gt; [T,Y] = ode15s(@odefunBR,[0 10],[0 0 0 4000 0 500 250 0]);&lt;br&gt;
&lt;br&gt;
so Qm is atan(0/0) which is atan(NaN) which is NaN and that propagates &lt;br&gt;
through the rest of the dy vector your function returns.  You need to &lt;br&gt;
determine how to fix that based on the problem you're trying to solve.&lt;br&gt;
&lt;br&gt;
BTW, from the code it looks like you're calling ODE15S from inside odefunBR, &lt;br&gt;
while specifying that your ODE function is also odefunBR.  You shouldn't do &lt;br&gt;
this -- see Q4.15 in the newsgroup FAQ for the reason why you shouldn't do &lt;br&gt;
this and how to avoid it.&lt;br&gt;
&lt;br&gt;
-- &lt;br&gt;
Steve Lord&lt;br&gt;
slord@mathworks.com&lt;br&gt;
comp.soft-sys.matlab (CSSM) FAQ: &lt;a href=&quot;http://matlabwiki.mathworks.com/MATLAB_FAQ&quot;&gt;http://matlabwiki.mathworks.com/MATLAB_FAQ&lt;/a&gt; </description>
    </item>
  </channel>
</rss>

