{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# Lecture14 - Engineering Analysis ENG 3420 Fall 2009 Dan C...

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

Engineering Analysis ENG 3420 Fall 2009 Dan C. Marinescu Office: HEC 439 B Office hours: Tu-Th 11:00-12:00

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

View Full Document
2 Lecture 14 Lecture 14 Last time: Solving systems of linear equations (Chapter 9) Graphical methods Cramer’s rule Gauss elimination Today: Discussion of pivoting Tri-diagonal system solver Examples Next Time LU Factorization (Chapter 10)
function x=GaussNaive(A,b) ExA=[A b]; [m,n]=size(A); q=size(b); if (m~=n) fprintf ('Error: input matrix is not square; n = %3.0f, m=%3.0f \n', n,m); End if (n~=q) fprintf ('Error: vector b has a different dimension than n; q = %2.0f \n', q); end n1=n+1; for k=1:n-1 for i=k+1:n factor=ExA(i,k)/ExA(k,k); ExA(i,k:n1)= ExA(i,k:n1)-factor*ExA(k,k:n1); End End x=zeros(n,1); x(n)=ExA(n,n1)/ExA(n,n); for i=n-1:-1:1 x(i) = (ExA(i,n1)-ExA(i,i+1:n)*x(i+1:n))/ExA(i,i); end

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

View Full Document