Matrix 2-norm Condition number

5 ビュー (過去 30 日間)
Ammar Taha
Ammar Taha 2020 年 7 月 5 日
コメント済み: Ammar Taha 2020 年 7 月 5 日
I wanted to compare the result of the fucntion [cond();] which retrun the matrix 2-norm condition number as a ratio between the largest and the smallest singular value using the [isequal();] function with the result "segma" matrix of the SVD out of [svd();] fucntion as:
A = [1 2 5;4 8 7;8 9 5]; % example
[u,s,v] = svd(A);
c_num = cond(A);
sing_ratio = s(1,1)/s(end,end);
isequal(c_num, sing_ratio);
and the reslut was [0] although they are the same, and sadly this isn't the first tine that the equal function fails with me and don't know the reason.

採用された回答

Matt J
Matt J 2020 年 7 月 5 日
編集済み: Matt J 2020 年 7 月 5 日
sadly this isn't the first tine that the equal function fails with me and don't know the reason.
The isequal() function didn't fail. The two results are different ... just not by very much:
>> percent_difference=abs(c_num - sing_ratio)./c_num*100,
percent_difference =
2.4864e-14
If you want to know how cond() is computed, you can just read it:
>> type cond.m
  1 件のコメント
Ammar Taha
Ammar Taha 2020 年 7 月 5 日
Thanks very much, I didn't give an attention to the infinitesimally small difference between them, but I got it when adjusted the format to be long.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLinear Algebra についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by