Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.


dpb
Posts:
9,219
Registered:
6/7/07


Re: 1.#IND00 in matlab
Posted:
Jan 3, 2013 8:17 AM


On 1/3/2013 1:05 AM, Bruno Luong wrote: > majeti dinesh <dinesh.majeti@gmail.com> wrote in message > <4652729e016d42daaee513161b163b69@googlegroups.com>... >> Can you explain with some code as to how to use try...catch? > > I think try/catch suggestion is not good, Inf and NaN result from an > arithmetic expression is not an error, thus cannot be catch.
Yeah, I realized that later...a shortcoming in Matlab that can't set FP error condition flag dynamically for such things... :(
OP  you'll just have to catch the problem case of u1==1 and make a fixup either before or after depending on what you want/need.
You could just generate the variate then replace NaN or Inf w/ another value or test the rnv u1 and reject the value 1 before the computationyour choice again depending on the need.
It's only the u1==1 that is causing the problem if the previous case is the only place like this in your codetry
0*1/0 1*1/0
at the command line to understand...




