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

1 view (last 30 days)
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.

Accepted Answer

Christine Tobler
Christine Tobler on 10 Dec 2019
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.

More Answers (2)

Chuguang Pan
Chuguang Pan on 9 Dec 2019
Edited: Chuguang Pan on 9 Dec 2019
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 on 9 Dec 2019
What other should I use. I fixed my typo but still and may be it was backslash but no . Please any other suggestion

Products

Community Treasure Hunt

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

Start Hunting!