Analisis numericopractica3

# Analisis numericopractica3 - v,i e s = max abs A k n,k B =...

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

An´ alisis Num´ erico Factorizaci´ on LU 26 de marzo de 2011 1. Implementar el algoritmo de sustituci´on progresiva. Algoritmo de sustitucion progresiva function x=sp(L,b) n=size(L); n=n(1); x=zeros(n,1); for i=1:n S=0; for k=1:i-1 S=S+x(k)*L(i,k); end x(i)=(b(i)-S)/(L(i,i)); end 2. Implementar el algoritmo de sustituci´on regresiva. Algoritmo de sustitucion regresiva function x=sr(L,b) n=size(L); n=n(1); x=zeros(n,1); for i=n:-1:1 S=0; for k=n:-1:i+1 S=S+x(k)*L(i,k); end x(i)=(b(i)-S)/(L(i,i)); end 3. Implementar el algoritmo factorizaci´ on LU. function [L,U]=ﬂu(A) n=size(A); 1

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

View Full Document
n=n(1); L=eye(n); for k=1:n-1 for i=k+1:n L(i,k)=A(i,k)/A(k,k); for j=k+1:n A(i,j)=A(i,j)-L(i,k)*A(k,j); end end end U=triu(A); 4. Implementar el algoritmo de factorizaci´on LU con pivoteo. function [L,U]=ﬂuP(A) n=size(A); n=n(1); L=eye(n); for k=1:n-1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: [ v,i e s ] = max ( abs ( A ( k : n,k ))); B = camb ( A ( k : n,k : n ) ,k,i,i e s ); A(k:n,k:n)=B; for i=k+1:n L(i,k)=A(i,k)/A(k,k); for j=k+1:n A(i,j)=A(i,j)-L(i,k)*A(k,j); end end end U=triu(A); 5. Implementar el algoritmo factorizaci´ on LU con pivoteo por ﬁlas y columnas. Algoritmo de factorizaci´on LU con pivoteo parial por ﬁlas function [LT,U,PT]=ﬂup(A) n=size(A); n=n(1); L=eye(n); P=L; LT=P; PT=P; for k=1:n-1 [ v,i e s ] = max ( abs ( A ( k : n,k ))); B = cambiodefilas ( A ( k : n,k : n ) , 1 ,i e s ); 2 A(k:n,k:n)=B; P = cambiodefilas ( eye ( n ) ,k,i e s + k-1); PT=PT*P; L=eye(n); for i=k+1:n L(i,k)=A(i,k)/A(k,k); for j=k+1:n A(i,j)=A(i,j)-L(i,k)*A(k,j); end end L=P’*L; LT=LT*L; end U=triu(A); 3...
View Full Document

{[ snackBarMessage ]}

### Page1 / 3

Analisis numericopractica3 - v,i e s = max abs A k n,k B =...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online