Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Alternative solution for NAN
Date: Wed, 27 Feb 2013 09:02:09 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 9
Message-ID: <kgki2g$rie$1@newscl01ah.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: www-06-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1361955729 28238 172.30.248.38 (27 Feb 2013 09:02:09 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 27 Feb 2013 09:02:09 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2671557
Xref: news.mathworks.com comp.soft-sys.matlab:789885

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 :( Are there any alternative solution instead of this loop to solve the NAN problem ?