Wrong answers given by MATLAB LU Factorization

11 ビュー (過去 30 日間)
Zhuo
Zhuo 2014 年 1 月 15 日
コメント済み: José-Luis 2014 年 1 月 15 日
LU factorization or decomposition method is supposed to decompose a square matrix to a lower matrix and a upper matrix. However, I tried to test some 2 by 2 matrix, the MATLAB LU method sometimes give me 2 upper matrix. Such an original matrix as:
A=[4 , 3 ; 6 , 3]
The answer given by MATLAB:
[L,U]=lu(A)
L=[0.667,1 ; 1, 0]
U=[6, 3 ; 0, 1]
The correct answer should be
L=[1 , 0 ; 1.5, 1]
U=[4 , 3 ; 0, -1.5]
I don't understand why MATLAB gives me such answer
Please, someone help me!

回答 (2 件)

Sean de Wolski
Sean de Wolski 2014 年 1 月 15 日
The behavior you are seeing is described in Example 1 of the lu documentation:
  1 件のコメント
Zhuo
Zhuo 2014 年 1 月 15 日
Hello, Thank you very much for your help.
I think the only way to let MATLAB to give me the correct format of lower matrix is to use: [L,U,P]=lu(A) But I have to pre-multiply the inverse of P in order to convert back to A Do you know there is a way to let MATLAB to give me an upper and a lower matrix straight away without involving intermediate matrix, such as P ?

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


José-Luis
José-Luis 2014 年 1 月 15 日
Both answers are valid.
A = [2/3,1 ; 1, 0] *[6, 3 ; 0, 1]
B = [1 , 0 ; 1.5, 1] * [4 , 3 ; 0, -1.5]
A == B
  2 件のコメント
Zhuo
Zhuo 2014 年 1 月 15 日
Thank you very much! I know both answers are valid. However, it is very necessary to write one of the matrix in lower matrix format which is easier for my program to take further calculations.
José-Luis
José-Luis 2014 年 1 月 15 日
I don't understand what you mean.

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

カテゴリ

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