Sie sind auf Seite 1von 16

Linear Algebraic Equations

Chapter 11 Special Matrices and Gauss-Seidel Gauss-

Special Matrices and Gauss-Seidel GaussWe will cover 11.1 Special matrices 11.2 GAUSS-SEIDEL

MATLAB M-files tri_diag.m

11.1 Special Matrices


A banded matrix is a square matrix that has all element equal to zero, with the exception of a band centered on the main diagonal. Banded systems are frequently encountered in engineering and scientific practice.
HBW: Half Band Width

Banded Matrix ai,j= 0


if j > i + HB or j< i - HB HB: Half Bandwidth B: Bandwidth B = 2*HB + 1

a c 0 0 0 0 0

b d f 0 0 0 0 0 0

0 e g i 0 0 0 0 0

0 0 h j l 0 0 0 0

0 0 0 k k 0 0 0

0 0 0 0 z q 0 0

0 0 0 0 0 p r t 0

0 0 0 0 0 0 s u

0 0 0 0 0 0 0 v

m n

In this example HB = 1 & B = 3

0 0

w x

11.1 .1 Tridiagonal Matrix


Only three nonzero elements in each equation Subdiagonal, diagonal, superdiagonal Solve by Gauss elimination
f1 e 2 g1 f2 e3 g2 f3 1 g3 1 ei 1 fi 1 gi 1 e n1 1 f n 1 en x1 x 2 x 3 / ! xi / n1 g n 1 x fn x n r1 r 2 r3 / ri / r n  1 rn

 Forward elimination
ek f k ! fk  f g k1 k 1 k ! 2 , 3, - , n ! r  ek r rk k k 1 fk 1
Use factor = ek / fk1

to eliminate subdiagonal element Apply the same matrix operations to right hand side

 Back substitution
xn ! rn fn k ! n  1, n  2, - , 3, 2 , 1

rk  g k x k  1 xk ! fk

Hand Calculations: Tridiagonal Matrix


1 2 0 0 2 5 1 0 0 1 2 0. 5 0 x1 x 0 2 x 0.5 3 x 1.25 4 3 5 2 .5 3

(a) Forward elimination


2 e f2 ! f2  2 g1 ! 5  ( 2 ) ! 1 f1 1 ! r  e 2 r ! 5   2 (  3 ) ! 1 r 2 1 2 f1 1 1 e f3 ! f3  3 g2 ! 2  ( 1) ! 1 f2 1 ! r  e 2 r ! 2   1 ( 1) ! 1 r 2 1 3 f1 1  0.5 e f 4 ! f 4  4 g 3 ! 1.25  ( 0.5 ) ! 1 f3 1 ! r  e 4 r ! 3.5   0.5 ( 1) ! 4 r 4 3 4 f3 1

(b) Back substitution

x4 ! x3 !

r4 4 ! !4 f4 1 r3  g 3 x 4 1  ( 0.5 )( 4 ) ! !3 f3 1

r2  g 2 x 3  1  ( 1)( 3 ) ! !2 x2 ! f2 1 x1 ! r1  g 1 x 2  3  ( 2 )( 2 ) ! !1 f1 1

MATLAB M-file: tri_diag.m M-

Example 11.1

2.04 1 0 0

T 0 .8 40 1 T2 2.04 1 0 .8 0 ! .8 0 1 2.04 1 T3 0 1 2.04 .8 200 T4 0

1

>> A=[2.04 -1 0 0; -1 2.04 -1 0; 0 -1 2.04 -1; 0 0 -1 2.04] A= 2.0400 -1.0000 0 0 -1.0000 2.0400 -1.0000 0 0 -1.0000 2.0400 -1.0000 0 0 -1.0000 2.0400 >> rhs=[40.8 0.8 0.8 200.8] rhs = 40.8000 0.8000 0.8000 200.8000 >> x = tri_diag(A,rhs) x= 65.9698 93.7785 124.5382 159.4795

11.2 GAUSS-SEIDEL GAUSS Iterative or approximate methods provide an alternative to the elimination methods. The Gauss-Seidel method is the most commonly used iterative method. The system [A]{X}={B} is reshaped by solving the first equation for x1, the second equation for x2, and the third for x3, and nth equation for xn. For conciseness, we will limit ourselves to a 3x3 set of equations.

b1  a12 x2  a13 x3 x1 ! a11 b2  a21 x1  a23 x3 x2 ! a22 b3  a31 x1  a32 x2 x1 ! a33

Now we can start the solution process by choosing guesses for the x s. A simple way to obtain initial guesses is to assume that they are zero. These zeros can be substituted into x1equation to calculate a new x1=b1/a11.

New x1 is substituted to calculate x2 and x3. The procedure is repeated until the convergence criterion is satisfied:

I a ,i

xij  xij 1 ! 100% I s j xi

For all i, where j and j-1 are the present and previous iterations.

Fig. 11.4

Convergence Criterion for Gauss-Seidel GaussMethod


The Gauss-Seidel method has two fundamental problems as any iterative method:
It is sometimes nonconvergent, and If it converges, converges very slowly. Figure 11.5

MATLAB M-file: M-file:

Example 11.3

Das könnte Ihnen auch gefallen