solve A*X=B containing very large or small elements

2 ビュー (過去 30 日間)
hosein Javan
hosein Javan 2020 年 8 月 9 日
コメント済み: Bruno Luong 2020 年 8 月 10 日
hello
i have this linear system of equations A*X=B, which is apparently ill-conditioned with RCOND = 0. the elements in these matrices are either extremely large or small which have been derived using "besseli" and "besselk" functions.
A=
2.7673e+84 -2.7673e+84 -9.1252e-88 0 0 0 0 0 0 0
1.1039e+87 -2.2078e+90 7.2433e-82 0 0 0 0 0 0 0
0 7.7866e+105 2.5944e-109 -7.7866e+105 -2.5944e-109 0 0 0 0 0
0 6.2089e+111 -2.0604e-103 -6.2089e+111 2.0604e-103 0 0 0 0 0
0 0 0 1.5218e+110 1.2764e-113 -1.5218e+110 -1.2764e-113 0 0 0
0 0 0 1.2134e+116 -1.0138e-107 -1.2134e+116 1.0138e-107 0 0 0
0 0 0 0 0 2.2359e+127 7.5295e-131 -2.2359e+127 -7.5295e-131 0
0 0 0 0 0 1.7822e+133 -5.9817e-125 -8.9112e+129 2.9909e-128 0
0 0 0 0 0 0 0 1.9154e+170 6.5919e-174 -6.5919e-174
0 0 0 0 0 0 0 7.6309e+172 -2.6195e-171 5.239e-168
B=
-5.3706e+78
-4.2847e+84
1.5112e+100
1.205e+106
0
0
0
0
0
0
the solution is returend using X=A\B :
X=
0
1.9407e-06
4.6374e+150
8.1617e-89
4.6374e+150
1.5549e-107
4.6374e+150
-3.1817e-193
9.2546e+150
9.2616e+147
but it has realy large error:
A*X-B=
-8.2275e+63
0
-1.9427e+84
0
1.8889e+22
0
0
-1.0771e+10
-2.25e-39
0
also I am uncertained that in the future I might need to calculate other matrices which could probably contain even larger or smaller values that leads to "inf" or "0" elements.
I know that using "digits" and "vpa" functions in symbolic math toolbox it is really accurate but SPEED plays an important role in my code.
I have searched about "Fixed-point Designer Tollbox" but I did not find an example like mine.
what is the best workaround in this condition?

採用された回答

Bruno Luong
Bruno Luong 2020 年 8 月 9 日
編集済み: Bruno Luong 2020 年 8 月 9 日
Work with unitless system, scale your matrix, or use automatic scaling if you don't want to bother.
  4 件のコメント
hosein Javan
hosein Javan 2020 年 8 月 10 日
Exactly. I must scale the unknown vector "X" to "X=C.*X1" in which "C" is scaling coefficiets vector. and therefore the equation "A*X=B" must be transfomed into "A*(C.*X1)=B" or "A1*X1=B". in which "A1=A.*repmat(C.',[length(X) 1])". now that "A1" and "X1" are scaled and "A1" is well-conditioned; the solution is "X=C.*X1=C.*(A1\B)". am I rigth?
I think that's the spot.
many thanks.
Bruno Luong
Bruno Luong 2020 年 8 月 10 日
Yes

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

その他の回答 (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