<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/266423</link>
    <title>MATLAB Central Newsreader - Approximation problem???</title>
    <description>Feed for thread: Approximation problem???</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>Fri, 20 Nov 2009 16:42:18 -0500</pubDate>
      <title>Approximation problem???</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/266423#696387</link>
      <author>Tales </author>
      <description>Hi,&lt;br&gt;
&lt;br&gt;
I am having a really weird problem that I cant find a reason. After a lot of calculation I was getting a wrong value for a variable, so I debbuged to find where was the problem, and I found a simple division mistake. A double h=0.0030 and another double hh=1/h . &lt;br&gt;
Of course hh is suposed to be 333.3333 but I am getting hh=333.8898&lt;br&gt;
Here is the piece of code:&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;h=str2double(cell2mat(raw(nameLinNum,densColumn)));&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;hh=1/h;&lt;br&gt;
&lt;br&gt;
Does anyone hava an idea on how to fix it???&lt;br&gt;
&lt;br&gt;
Thanks</description>
    </item>
    <item>
      <pubDate>Fri, 20 Nov 2009 17:01:47 -0500</pubDate>
      <title>Re: Approximation problem???</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/266423#696391</link>
      <author>dpb</author>
      <description>Tales wrote:&lt;br&gt;
...&lt;br&gt;
&amp;gt; I am having a really weird problem that I cant find a reason. After a&lt;br&gt;
&amp;gt; lot of calculation I was getting a wrong value for a variable, so I&lt;br&gt;
&amp;gt; debbuged to find where was the problem, and I found a simple division&lt;br&gt;
&amp;gt; mistake. A double h=0.0030 and another double hh=1/h .&lt;br&gt;
&amp;gt; Of course hh is suposed to be 333.3333 but I am getting hh=333.8898&lt;br&gt;
&amp;gt; Here is the piece of code:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;                 h=str2double(cell2mat(raw(nameLinNum,densColumn)));&lt;br&gt;
&amp;gt;                 hh=1/h;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Does anyone hava an idea on how to fix it???&lt;br&gt;
...&lt;br&gt;
&lt;br&gt;
Undoutedly h _isn't_ 0.00300000... but closer to 0.002995...&lt;br&gt;
&lt;br&gt;
Try&lt;br&gt;
&lt;br&gt;
disp(h-0.0030)&lt;br&gt;
&lt;br&gt;
during a debugging session and see what is returned.&lt;br&gt;
&lt;br&gt;
Why that is isn't determinable from the data provided but delving into &lt;br&gt;
where the underlying data come from and how they're processed will &lt;br&gt;
surely uncover same.&lt;br&gt;
&lt;br&gt;
--</description>
    </item>
  </channel>
</rss>

