1 / 4

function [x]= solsup(U,b) [n,m]=size(U); x=zeros(n,1); if abs(U(n,n))<%eps

function [x]= solsup(U,b) [n,m]=size(U); x=zeros(n,1); if abs(U(n,n))<%eps error('un pivot de Gauss n''est pas défini'); end x(n)=b(n)/U(n,n); for i=n-1:-1:1 if abs(U(i,i))<%eps error('un pivot de Gauss n''est pas défini'); end x(i)=(b(i)-U(i,i+1:n)*x(i+1:n))/U(i,i);

jamese
Télécharger la présentation

function [x]= solsup(U,b) [n,m]=size(U); x=zeros(n,1); if abs(U(n,n))<%eps

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. function [x]= solsup(U,b) [n,m]=size(U); x=zeros(n,1); if abs(U(n,n))<%eps error('un pivot de Gauss n''est pas défini'); end x(n)=b(n)/U(n,n); for i=n-1:-1:1 if abs(U(i,i))<%eps error('un pivot de Gauss n''est pas défini'); end x(i)=(b(i)-U(i,i+1:n)*x(i+1:n))/U(i,i); end endfunction function [U,e]=trisup(A,b) [n,m]=size(A); U=A; e=b; for k=1:n-1 if abs(U(k,k))<%eps error('pivot nul'); else for i=k+1:n c=U(i,k)/U(k,k); e(i)=e(i)-c*e(k); U(i,k)=0; U(i,k+1:n)=U(i,k+1:n)-c*U(k,k+1:n); end end end if abs(U(n,n))<%eps error('pivot nul'); endfunction

  2. function [x] = resolG(A,b) getf trisup.sci getf solsup.sci [U,e]=trisup(A,b); x=solsup(U,e); endfunction function [L,U]=LU(A) [n,m]=size(A); L=eye(n,n); U=A; for k=1:n-1 if abs(U(k,k))<%eps error('pivot nul'); else for i=k+1:n c=U(i,k)/U(k,k); U(i,k)=0; L(i,k)=c; U(i,k+1:n)=U(i,k+1:n)-c*U(k,k+1:n); end end end if abs(U(n,n))<%eps error('pivot nul'); end endfunction

  3. function [x]= solinf(U,b) [n,m]=size(U); x=zeros(n,1); if abs(U(1,1))<%eps error('un pivot de Gauss n''est pas défini'); end x(1)=b(1)/U(1,1); for i=2:n if abs(U(i,i))<%eps error('un pivot de Gauss n''est pas défini'); end x(i)=(b(i)-U(i,1:i-1)*x(1:i-1))/U(i,i); end endfunction function [x]= resolLU(A,b) getf LU.sci getf solinf.sci getf solsup.sci [L,U]=LU(A); y=solinf(L,b); x=solsup(U,y); endfunction

  4. function [B]= inverse(A) getf reslLU.sci; [u v]=size(A); B=zeros(u,u); I=eye(u,u); for i=1:u B(1:u,i)=resolLU(A,I(1:u,i)); end endfunction

More Related