logo

Gram-Schmidt Process for QR Factorization of Matrix A in MATLAB | MATH 240

   

Added on  2023-05-29

24 Pages3739 Words277 Views
 | 
 | 
 | 
Running head: MATLAB PROJECT 4
MATH 240
MATLAB PROJECT 4
Name of the Student
Name of the University
Author Note
Gram-Schmidt Process for QR Factorization of Matrix A in MATLAB | MATH 240_1

1MATLAB PROJECT 4
0. The command clock is entered in MATLAB which displays the current year, month,
date and time in the following format.
[year month day hour minute seconds]
MATLAB command and output:
clock
ans =
2018 11 26 12 40 32.391
Hence, the current date and time is 26th November 2018, 12 PM 40 minutes and
32.391 secs.
1. The matrix A = [ 345 654 928
84 158 228
66 126 176 ]
The diagonalization of the matrix A is performed by the following method.
A=PDP1
Where, D is the diagonal matrix and P is the eigenvector matrix which is invertible.
Matrix diagonalization is very much useful in computation of An where n is any
positive integer.
a) A =[345 -654 -928;84 -158 -228;66 -126 -176]
A =
345 -654 -928
84 -158 -228
66 -126 -176
[P,D] = eig(A)
P =
0.95702 -0.94561 0.9577
0.20508 -0.29096 0.15962
Gram-Schmidt Process for QR Factorization of Matrix A in MATLAB | MATH 240_2

2MATLAB PROJECT 4
0.20508 -0.14548 0.23943
D =
6 0 0
0 1 0
0 0 4
b) Now, in MATLAB diagonalization is verified.
P*D*P^(-1)
ans =
345 -654 -928
84 -158 -228
66 -126 -176
Hence, as the matrix is equal to A, it can be said that diagonalization is performed
correctly by MATLAB.
c) Now, by using the previous results the eigenvectors and their corresponding Eigen
values are given below.
Eigen value = 6, Eigen vector = [ 0.95702
0.20508
0.20508 ]
Eigen value = 1, Eigen vector = [0.94561
0.29096
0.14548 ]
Eigen value = 4, Eigen vector = [ 0.9577
0.15962
0.23943 ]
2. The given matrix A = [ 65 39 15
100 60 23
22 13 6 ]
a) In MATLAB values of An for n = 2,3,4,5,6,7,8 are obtained as follows.
>> A^2
Gram-Schmidt Process for QR Factorization of Matrix A in MATLAB | MATH 240_3

3MATLAB PROJECT 4
ans =
-5 0 -12
6 -1 18
2 0 5
>> A^3
ans =
61 39 3
-94 -60 -5
-20 -13 0
>> A^4
ans =
1 0 0
0 1 0
0 0 1
>> A^5
ans =
-65 -39 -15
100 60 23
22 13 6
>> A^6
ans =
-5 0 -12
6 -1 18
2 0 5
>> A^7
Gram-Schmidt Process for QR Factorization of Matrix A in MATLAB | MATH 240_4

4MATLAB PROJECT 4
ans =
61 39 3
-94 -60 -5
-20 -13 0
>> A^8
ans =
1 0 0
0 1 0
0 0 1
Hence, a pattern is observed which repeats for every n=4 increments. The matrixes
are same for n=1,2,3,4 and n=5,6,7 and 8.
b) Now, the matrix diagonalization is performed like the previous way.
[P,D] = eig(A)
P =
-0.53609 + 0.0089348i -0.53609 - 0.0089348i -0.53452 + 0i
0.82498 + 0i 0.82498 + 0i 0.80178 + 0i
0.1787 - 0.0029783i 0.1787 + 0.0029783i 0.26726 + 0i
D =
-8.8523e-15 + 1i 0 + 0i 0 + 0i
0 + 0i -8.8523e-15 - 1i 0 + 0i
0 + 0i 0 + 0i 1 + 0i
Hence, it is seen that there are two Eigen values that are complex numbers and
one is real number. All the Eigen vectors corresponding to their Eigen values are
complex vectors.
c) Now, An =PDnP1, where n is any positive integer.
Gram-Schmidt Process for QR Factorization of Matrix A in MATLAB | MATH 240_5

5MATLAB PROJECT 4
So, the powers of the diagonal matrix D will have the powers of diagonal
elements which are powers of Eigen values. Now, the 3rd Eigen value is 1 and
hence all the diagonal matrixes for any values of n will have 1 in the bottom right
diagonal elements.
d) Now, as observed for the pattern the matrix A repeats itself after every n=4
intervals. Hence, A^4 = A^8 = A^12.....= I(Identity matrix)
Now, A^(10000001) = A^(1+4*2500000) = A( A4 )2500000 = A*I = A.
3. Now, the matrix is
A = [3 1
0 3 ]
a) Now, diagonalization is performed as before.
>> A = [3 1;0 3];
>> [P,D] = eig(A)
P =
1 -1
0 6.6613e-16
D =
3 0
0 3
Hence, it can be seen that the Eigen values are same but the Eigen vectors
corresponding to the Eigen values are different.
b) Now, the diagonalization is verified in MATLAB.
P*D*P^(-1)
ans =
3 0
Gram-Schmidt Process for QR Factorization of Matrix A in MATLAB | MATH 240_6

End of preview

Want to access all the pages? Upload your documents or become a member.