0% found this document useful (0 votes)
1K views2 pages

Show That Matrix A Is Singular

The document describes solving a system of linear equations using MATLAB. It provides the MATLAB syntax and output for: 1) Showing that a given matrix A is singular using the determinant function. 2) Finding the inverse and reduced row echelon form of a matrix A, and using Gaussian elimination to solve the system Ax=B. 3) Performing LU factorization on A to solve the system using back substitution.

Uploaded by

Aera
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views2 pages

Show That Matrix A Is Singular

The document describes solving a system of linear equations using MATLAB. It provides the MATLAB syntax and output for: 1) Showing that a given matrix A is singular using the determinant function. 2) Finding the inverse and reduced row echelon form of a matrix A, and using Gaussian elimination to solve the system Ax=B. 3) Performing LU factorization on A to solve the system using back substitution.

Uploaded by

Aera
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

MATLAB ACTIVITY 3 – Solving System of Linear Equation Using MATLAB

A. Using MATLAB commands compute the following expressions if possible. Write the MATLAB
SYNTAX you used and MATLAB out put on the space provided

     

1. Show that matrix A is singular

MATLAB SYNTAX MATLAB OUTPUT


A=[1,2,0;3,-1,2;-2,3,-2] A=
1 2 0
a=sym(A) 3 -1 2
-2 3 -2
c=det(a) a=
[ 1, 2, 0]
if(c==0) [ 3, -1, 2]
[-2, 3, -2]
disp('The matrix is singular')
c=
end
0
The matrix is singular

2.) a. Inverse of Matrix

MATLAB SYNTAX MATLAB OUTPUT

A= [2,3,1;3,3,1;2,4,1] A =
2 3 1
3 3 1
2 4 1
B=[-1;1;-2] B =
-1
1
-2
C=
-1.0000 1.0000 -0.0000
C=inv(A)
-1.0000 0 1.0000
6.0000 -2.0000 -3.0000

b. Gaussian Elimination

MATLAB SYNTAX MATLAB OUTPUT

z=rref([A B]) z =
1 0 0 2
0 1 0 -1
0 0 1 -2

c. LU- Factorization

MATLAB SYNTAX MATLAB OUTPUT

[L U P]=lu(A) L =
1.0000 0 0
0.6667 1.0000 0
0.6667 0.5000 1.0000
U =
3.0000 3.0000 1.0000
0 2.0000 0.3333
0 0 0.1667
P =
0 1 0
0 0 1
1 0 0

y=rref([P*L B]) y =

1.0000 0 0 -2.0000
0 1.0000 0 0.3333
0 0 1.0000 2.1667

x=rref([U y]) x =

1.0000 0 0 0.3333 -0.5000 -1.0000 -3.0000


0 1.0000 0 0 0.5000 -1.0000 -2.0000
0 0 1.0000 0 0 6.0000 13.0000

You might also like