Graphics Programs Reference
In-Depth Information
d = 6*ones(n,1); d(n) = 7;
e = -4*ones(n-1,1);
f = ones(n-2,1);
b=zeros(n,1);b(1)=3;b(n)=4;
[d,e,f] = LUdec5(d,e,f);
x = LUsol5(d,e,f,b)
The outputfrom the program is
>>x=
2.3872
4.1955
5.4586
6.2105
6.4850
6.3158
5.7368
4.7820
3.4850
1.8797
2.5
Pivoting
Introduction
Sometimes the orderinwhich the equations are presented to the solutionalgorithm
has a significant effect on the results.For example, consider the equations
2 x 1
x 2 =
1
x 1 +
2 x 2
x 3 =
0
x 2 +
x 3 =
0
The corresponding augmented coefficient matrix is
2
1
0
1
A
b
=
12
1
0
(a)
0
110
Equations(a) are in the “right order” in the sense that we would have notrouble
obtaining the correct solution x 1 =
x 2 =
x 3 =
1byGauss elimination orLU decom-
position. Now suppose that weexchange the first and third equations, so that the
Search WWH ::




Custom Search