Analisis numericopractica3

Analisis numericopractica3 - [ v,i e s ] = max ( abs ( A (...

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

View Full Document Right Arrow Icon
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]=flu(A) n=size(A); 1
Background image of page 1

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

View Full DocumentRight Arrow Icon
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]=fluP(A) n=size(A); n=n(1); L=eye(n); for k=1:n-1
Background image of page 2
Background image of page 3
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 factorizacion 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

Page1 / 3

Analisis numericopractica3 - [ v,i e s ] = max ( abs ( A (...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online