Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- A=input("Enter the element of matrix "); //should be [1,6,1,-1;0,2,-1,1;1,-3,-2,-2;0,4,-1,1]
- B=input("Enter the result of matrix "); // should be [14;10;-10;18]
- disp(A)
- I=eye(4,4);
- U=A;
- U(2,:)=-2*U(1,:)+U(2,:)
- E1=I;
- E1(2,:)=-2*E1(1,:)+E1(2,:);
- U(2,:)=U(2,:)/-11;
- E2=I;
- E2(2,:)=E2(2,:)/-11;
- U(3,:)=U(2,:)+U(3,:);
- E3=I;
- E3(3,:)=E3(2,:)+E3(3,:);
- U(3,:)=U(3,:)/3;
- E4=I;
- E4(3,:)=E4(3,:)/3;
- U(4,:)=U(4,:)/3;
- E5=I;
- E5($,:)=E5(4,:)/3;
- L=inv(E1)*inv(E2)*inv(E3)*inv(E4)*inv(E5);
- U(4,:)=U(4,:)/3;
- y=inv(L)*B;
- disp("Solusi persamaam Ly = b")
- disp(y)
- x=inv(U)*y;
- disp("Solusi persamaan Ux = y")
- disp(x)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement