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.
0 个评论
采纳的回答
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.
0 个评论
更多回答(2 个)
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.
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!