You are on page 1of 5

>> A = [-3 2 -3;3 3 -2;2 -2 3] 3x3

A =

-3 2 -3

3 3 -2

2 -2 3

>> A = [-3 2 -3;3 3 -2;2 -2 3];

>> b = [-8 3 7];

>> b = [-8;3;7];

>> b

b =

-8

L(1,1) = 1; L(1,2) = 0; L(1,3) = 0;

L(2,1) = A(2,1)/A(1,1); L(2,2) = L(2,2)-(L(2,1)*A(1,2)); L(2,3) =


L(2,3)-(L(2,1)*A(1,3));

L(2,1) = A(2,1)/A(1,1); L(2,2) = 1; L(2,3) = 0;

L(3,1)=-2/3; L(3,2)=-2/15; L(3,3)=1;

L =

1 0 0

-1 1 0

-2/3 -2/15 1

U(1,1)=-3; U(1,2)=2; U(1,3)=-3;


>> U(2,1)=A(2,1)-(A(1,1)*L(2,1));

>> U(2,2)=A(2,2)-(A(1,2)*L(2,1));

>> U(2,3)=A(2,3)-(A(1,3)*L(2,1));

>> U(3,1)=A(3,1)-(A(1,1)*L(3,1));

>> U(3,2)=A(3,2)-(A(1,2)*L(3,1));

>> U(3,3)=A(3,3)-(A(1,3)*L(3,1));

U =

-3 2 -3

0 5 -5

0 -2/3 1

U(3,1)=U(3,1)-(U(2,1)*L(3,2));

U(3,2)=U(3,2)-(U(2,2)*L(3,2));

U(3,3)=U(3,3)-(U(2,3)*L(3,2));

U =

-3 2 -3

0 5 -5

0 0 1/3

y=inv(L)*b

y =

-8

-5

>> x=inv(U)*y

x =

3
A=[4 -3 2 1;3 1 3 -1;1 3 -2 3;2 2 1 1]; 4x4
b=[-7;0;8;2];

L(1,1)=1;
L(1,2)=0;
L(1,3)=0;
L(1,4)=0;

L(2,1)=A(2,1)/A(1,1);
L(2,2)=1;
L(2,3)=0;
L(2,4)=0;

U(1,1)=4;
U(1,2)=-3;
U(1,3)=2;
U(1,4)=1;

U(2,1)=A(2,1)-L(2,1)*A(1,1);
U(2,2)=A(2,2)-L(2,1)*A(1,2);
U(2,3)=A(2,3)-L(2,1)*A(1,3);
U(2,4)=A(2,4)-L(2,1)*A(1,4);

L(3,1)=A(3,1)/A(1,1);

U(3,1)=A(3,1)-L(3,1)*A(1,1);
U(3,2)=A(3,2)-L(3,1)*A(1,2);
U(3,3)=A(3,3)-L(3,1)*A(1,3);
U(3,4)=A(3,4)-L(3,1)*A(1,4);

L(4,1)=A(4,1)/A(1,1);

U(4,1)=A(4,1)-L(4,1)*A(1,1);
U(4,2)=A(4,2)-L(4,1)*A(1,2);
U(4,3)=A(4,3)-L(4,1)*A(1,3);
U(4,4)=A(4,4)-L(4,1)*A(1,4);

L(3,2)=U(3,2)/U(2,2);
L(3,3)=1;
L(3,4)=0;

U(3,1)=U(3,1)-L(3,2)*U(2,1);
U(3,2)=U(3,2)-L(3,2)*U(2,2);
U(3,3)=U(3,3)-L(3,2)*U(2,3);
U(3,4)=U(3,4)-L(3,2)*U(2,4);

L(4,2)=U(4,2)/U(2,2);
U(4,1)=U(4,1)-L(4,2)*U(2,1);
U(4,2)=U(4,2)-L(4,2)*U(2,2);
U(4,3)=U(4,3)-L(4,2)*U(2,3);
U(4,4)=U(4,4)-L(4,2)*U(2,4);

L(4,3)=U(4,3)/U(3,3);
L(4,4)=1;

U(4,1)=U(4,1)-L(4,3)*U(3,1);
U(4,2)=U(4,2)-L(4,3)*U(3,2);
U(4,3)=U(4,3)-L(4,3)*U(3,3);
U(4,4)=U(4,4)-L(4,3)*U(3,4);

y=inv(L)*b;

x=inv(U)*y;

>> y

y =

-7

21/4

48/13

-86/55

>> x

x =

75/31

61/31

-4

-86/31
University of the East

College of Engineering

Electrical Engineering Department

MACHINE PROBLEM 2

Submitted by: I. Presentation:


Indaya, Ceejay V. II. Completeness:
Date Submitted: III. Discussion:
July 31, 2019 IV. Conclusion:

GRADE

Instructor
Engr. Darwin D. Alpis

You might also like