# 12 - "Naive Gaussian Elimination System of Equations 2 x1 3...

This preview shows pages 1–4. Sign up to view the full content.

2/24/2010 1 “Naive” Gaussian Elimination: System of Equations: 33 6 4 2 5 2 4 9 3 2 3 2 1 3 2 1 3 2 1 x x x x x x x x x System in matrix form (Ax = b): >> A = [2 3 1; 4 2 5; 1 4 6] A = 2 3 1 4 2 5 1 4 6 >> b = [9; 2; 33] b = 9 2 33 First step – form augmented matrix by combining A and b >> C = [A b] C = 2 3 1 9 4 2 5 2 1 4 6 33 In general: [M1 M2 M3 ... Mn] % OK as long as all matrices have same number of rows [M1; M2; M3; ... Mn] % OK as long as all matrices have same number of columns M1 M2 M3 Mn M1 M2 M3 Mn

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
2/24/2010 2 2 3 1 9 4 2 5 2 Pivot row Pivot 1 4 6 33 All elements below the pivot are converted to zero by applying row = row – (element below pivot/ pivot) * pivot row To be zeroed In this case row 2 = row 2 – (4/2) * pivot row row 3 = row 3 – (1/2) * pivot row Row 1 is the pivot row, C(1,1) is the pivot: P = C(1,1); Subtract C(2,1)/P times the pivot row from row 2: >> C(2,:) = C(2,:) - (C(2,1)/P) * C(1,:) C = 2 3 1 9 0 -8 3 -20 1 4 -6 33 Subtract C(3,1)/P times the pivot row from row 3: >> C(3,:) = C(3,:) - (C(3,1)/P) * C(1,:) C = 2.0000 3.0000 1.0000 9.0000 0 8 0000 3 0000 20 0000 0 -8.0000 3.0000 -20.0000 0 2.5000 -6.5000 28.5000