Search All of the Math Forum:

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

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Alternative solution for NAN
Replies: 11   Last Post: Feb 27, 2013 5:44 PM

 Messages: [ Previous | Next ]
 Tony Kittler Posts: 109 Registered: 2/5/11
Re: Alternative solution for NAN
Posted: Feb 27, 2013 6:17 AM

"Carl S." wrote in message <kgkpep\$h9u\$1@newscl01ah.mathworks.com>...
> "Torsten" wrote in message <kgko7b\$e4d\$1@newscl01ah.mathworks.com>...
> > "Carl S." wrote in message <kgkmon\$aeo\$1@newscl01ah.mathworks.com>...
> > > "Torsten" wrote in message <kgklbh\$6ph\$1@newscl01ah.mathworks.com>...
> > > > "Carl S." wrote in message <kgki2g\$rie\$1@newscl01ah.mathworks.com>...
> > > > > The following code gives NAN (Not a Number) values
> > > > > [U,D]=eig(N);
> > > > >
> > > > > To solve this problem, I wrote that
> > > > > while(det(N) == 0)
> > > > > N=(1e-10.*randi(1,size(N)))*eye(size(N));
> > > > > end
> > > > >
> > > > > But, the loop does not stop

> > > >
> > > > Your matrix N within the loop always has determinant (1e-10)^(size(N))
> > > > which may become very small if N is large.
> > > >
> > > > :( Are there any alternative solution instead of this loop to solve the NAN problem ?
> > > >
> > > > Depends on the original matrix N.
> > > >
> > > > Best wishes
> > > > Torsten.

> > >
> > > Dear Torsten,
> > > The matrix N has standard deviation values of grayscale images. So, it changes for each image. How to solve the NAN problem in this case ?

> >
> > Did you check whether the matrix N already contains NaN values ?
> >
> > Best wishes
> > Torsten.

>
> Yes, I have checked with this codes
>
> if isnan(N)==1
> h=1;
> else
> h=0;
> end
>
> This code return that h=0

Dear Torsten ,
I also wrote this;
checkNAN=sum(find(isnan(N)==1))
The value of checkNAN is zero :(

Date Subject Author
2/27/13 Tony Kittler
2/27/13 Torsten
2/27/13 Tony Kittler
2/27/13 Torsten
2/27/13 Tony Kittler
2/27/13 Tony Kittler
2/27/13 Tony Kittler
2/27/13 Torsten
2/27/13 Tony Kittler
2/27/13 Torsten
2/27/13 Steven Lord
2/27/13 Tony Kittler