Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 7.252760e-17.
4 views (last 30 days)
Show older comments
Tatiana Macha
on 9 Dec 2019
Answered: Christine Tobler
on 10 Dec 2019
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.
0 Comments
Accepted Answer
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.
0 Comments
More Answers (2)
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.
0 Comments
See Also
Categories
Find more on Linear Algebra in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!