Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function [L,U] = LUfp(A)
- if det(A)==0
- error('Matricea A nu este inversabila')
- else
- if size(A)~=size(A')
- error('Matricea A nu este patratica')
- end
- n=size(A,1);
- L=eye(n);
- U=zeros(n);
- S=zeros(n);
- for i=1:n
- S(i,i)=A(i,i);
- end
- for i=n:-1:2
- U(n-i+1,n-i+1)=S(i,i);
- L((n-i+2):end,n-i+1)=S(2:end,i)/S(i,i);
- S=L((n-i+2):end,n-i+1)*U(n-i+1,(n-i+2):end)+A((n-i+1):end,(n-i+1):end);
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement