Filter löschen
Filter löschen

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

11 Ansichten (letzte 30 Tage)
Eliza
Eliza am 16 Nov. 2017
Kommentiert: Eliza am 16 Nov. 2017
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

Antworten (1)

John D'Errico
John D'Errico am 16 Nov. 2017
Bearbeitet: John D'Errico am 16 Nov. 2017
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 Kommentar
Eliza
Eliza am 16 Nov. 2017
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 .

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Matrices and Arrays finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by