필터 지우기
필터 지우기

why i am not getting the exact answer when i use lu built in function?

조회 수: 11 (최근 30일)
Eliza
Eliza 2017년 11월 16일
댓글: Eliza 2017년 11월 16일
A=[25 5 1;64 8 1;144 12 1];
C=[106.8;177.2;279.2];
[L,U] = lu(A)
L =
0.1736 1.0000 0
0.4444 0.9143 1.0000
1.0000 0 0
U =
144.0000 12.0000 1.0000
0 2.9167 0.8264
0 0 -0.2000
and the manual solution is
L=
1 0 0
2.56 1 0
5.76 3.5 1
U=
25 5 1
0 -4.8 -1.56
0 0 0.7

답변 (1개)

John D'Errico
John D'Errico 2017년 11월 16일
편집: John D'Errico 2017년 11월 16일
An LU factorization is not unique. ONE such solution is the one that you came up with, probably due to an un-pivoted LU. The 25 in the (1,1) element of U suggests that you did no pivoting. For reasons of numerical computation, pivoting should always be used. If you computed an un-pivoted LU, then it will be less stable.
READ THE HELP FOR LU. READ THE HELP. ALWAYS.
help lu
[L,U] = lu(A) stores an upper triangular matrix in U and a
"psychologically lower triangular matrix" (i.e. a product of lower
triangular and permutation matrices) in L, so that A = L*U. A can be
rectangular.
The "psychologically lower triangular" result is due to the need for pivoting for stability.
For example, your code, which seems to lack pivoting, will fail to produce a viable result for a matrix like this:
A =[ 0 5 1
64 8 1
144 12 1];
which is indeed non-singular. But the built-in LU will have no problem.
  댓글 수: 1
Eliza
Eliza 2017년 11월 16일
yes ,you are right .I intentionally solve it as un-pivoting LU .Could I solve it also by MATLAB by using LU without pivoting ? because I wanna solve it for this matrix only as checking of my manually solution .

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by