Error using eigs. Input matrix is badly conditioned. It might contain Inf or NaN.
조회 수: 9 (최근 30일)
이전 댓글 표시
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
Walter Roberson
2020년 6월 23일
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?
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!