Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 7.252760e-17.

조회 수: 1 (최근 30일)
I need help
I got this message
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND =
7.252760e-17.
> In Rayleigh_method (line 11)
In project2_problem2 (line 19)
from line 11
v = (A-lambda*eye(n))\v;
and from line 19
[lambda_R,v_R,iter_R] = Rayleigh_method(A,v,tol);
this from Rayleigh_method
while (error > tol && iter < 100)
vo = v;
iter = iter+1;
v = (A-lambda*eye(n))\v;
v = v/norm(v);
lambda = v'*A*v;
error = norm(v-vo);
I think the error start from line 11.

채택된 답변

Christine Tobler
Christine Tobler 2019년 12월 10일
As lambda approaches an eigenvalue of A (which is the goal of your algorithm), the matrix A - lambda*eye(size(A)) becomes close to singular. But as it gets very close to singular, the numerical error in solving a linear system with this matrix increase - and if this matrix ever becomes exactly singular, there will not be an exact solution.
So at some point in this algorithm, you will need to detect that lambda is close enough to a singular value, and either stop or use some other strategy. But that this happens is a sign that the algorithm is doing the right thing, which is for lambda to approach an eigenvalue of A.

추가 답변 (2개)

Chuguang Pan
Chuguang Pan 2019년 12월 9일
편집: Chuguang Pan 2019년 12월 9일
It seems that A-lamda*eye(n) is nearly singular, you should check it carefully!
mabey you can use another computing method.

Tatiana Macha
Tatiana Macha 2019년 12월 9일
What other should I use. I fixed my typo but still and may be it was backslash but no . Please any other suggestion

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by