Date: Feb 27, 2013 4:02 AM Author: Tony Kittler Subject: Alternative solution for NAN 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 ?