LU Decomposition
                                            
 3220 단어  수치 분석
                    
function       [L,U,y,x]=LU(A,b)
%Input :     A is the coefficient matrix
%      :     b is the row vector
%Output:     L is the below triangle matrix
%      :     U is the above triangle matrix
%      :     y is the Ly=b
%      :     x is the solution of Ux=y
%Funciton:   LU to solve the equation
n=size(A,2);
U(1,:)=A(1,:);
L(:,1)=A(:,1)/U(1,1);
for r=2:n
for i=r:n
    U(r,i)=A(r,i)-L(r,1:r-1)*U(1:r-1,i);
    L(i,r)=(A(i,r)-L(i,1:r-1)*U(1:r-1,r))/U(r,r);
end
end
y=zeros(n,1);
y(1)=b(1);
for i=2:n
    y(i)=b(i)-L(i,1:i-1)*y(1:i-1);
end
x=zeros(n,1);
x(n)=y(n)/U(n,n);
for i=n-1:-1:1
    x(i)=(y(i)-U(i,i+1:n)*x(i+1:n))/U(i,i);
end
end
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
guass method텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.