Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: -1.#IND00 in matlab
Replies: 13   Last Post: Jan 3, 2013 8:17 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
dpb

Posts: 8,189
Registered: 6/7/07
Re: -1.#IND00 in matlab
Posted: Jan 3, 2013 8:17 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 1/3/2013 1:05 AM, Bruno Luong wrote:
> majeti dinesh <dinesh.majeti@gmail.com> wrote in message
> <4652729e-016d-42da-aee5-13161b163b69@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
computation--your 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 code--try

0*1/0
1*1/0

at the command line to understand...

--



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.