Error using eigs. Input matrix is badly conditioned. It might contain Inf or NaN.
3 views (last 30 days)
Show older comments
Hello all,
I have a varibale named psi, that is a 1x10940 cell array of cells, with each cell containing a 2x2 matrix. I calcualted phi using the folloiwing code:
T = 60; %60 Hz is 1.2 seconds
phi = cell([],1) ;
count = 0 ;
for t = 1:length(gyr)-T
count = count+1 ;
phi{count} = [(n1(1,t+T)-n2(1,t+T)) / (n1(1,t)-n2(1,t)),...
(n3(1,t+T)-n4(1,t+T)) / (n3(2,t)-n4(2,t));...
(n1(2,t+T)-n2(2,t+T)) / (n1(1,t)-n2(1,t)),...
(n3(2,t+T)-n4(2,t+T)) / (n3(2,t)-n4(2,t))];
end
i then try to use the eigs function to find the largest eigen value for each matrix of phi using the code,
for i = 1:length(phi);
lambda_max(1,i) = eigs(phi{1,i},1);
end
However, i get an error message saying "Input matrix is badly conditioned. It might contain Inf or NaN."
I undertsand that this error is a result of the method by which im calculating phi. Does anyone have any suggestion on how to remdy this.
The input values for the phi calcualtion, n1,n2,n3, and n4 are all 2x11000 arrays of coordinate points where the top row is the X position and the bottom row is the Y position.
Thank you for any help or assistance you can offer.
2 Comments
Walter Roberson
on 23 Jun 2020
find( cellfun(@(C) any(~isfinite(C(:))), psi) )
to locate entries with nan or inf.
I am confused that you are talking about psi but do not use that in your code.
Is there reason to believe that it is not possible for any of the subtractions in the denominators to be 0, leading to division by 0?
Answers (0)
See Also
Categories
Find more on Matrix Computations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!