I don't have this image. copyright wikipedia.org |
Ini source codenya saat kuliah dulu
A=[4 3 5 1;9 5 2 8;7 1 6 3;1 4 7 8]
b=[52;63;72;98]
L=eye(4)
U=zeros(4)
U(1,:)= A(1,:)
L(2,1)=A(2,1)/U(1,1)
L(3,1)=A(3,1)/U(1,1)
L(4,1)=A(4,1)/U(1,1)
U(2,2)=A(2,2)-L(2,1)*U(1,2)
U(2,3)=A(2,3)-L(2,1)*U(1,3)
U(2,4)=A(2,4)-L(2,1)*U(1,4)
L(3,2)=(A(3,2)-L(3,1)*U(1,2))/U(2,2)
U(3,3)= A(3,3)-(L(3,1)*U(1,3))-(L(3,2)*U(2,3))
U(3,4)=A(3,4)-(L(3,1)*U(1,4))-(L(3,2)*U(2,4))
L(4,2)= (A(4,2)-L(4,1)*U(1,2))/U(2,2)
L(4,3)= (A(4,3)-(L(4,1)*U(1,3)-L(4,2)*U(2,3))/U(3,3)
U(4,4)= A(4,4)-L(4,1)*U(1,4)-L(4,2)*U(2,4)-L(4,3)*U(3,4)
0 komentar:
Post a Comment