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 Center および File ExchangeMatrix Indexing についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by