Professional Documents
Culture Documents
2024 Ensc180 Lab 1
2024 Ensc180 Lab 1
Submission instruction: Since the questions in Lab 1 are quite easy, please include all of your
commands, the corresponding outputs, and your analysis (if asked) as a single pdf file, with
necessary titles (such as Q1.1). No need to submit separate Matlab file. For example,
Q1.1:
>> a = 10
a =
10
1) (5 points) Use the sum( ) function to find the mean value of the vector, which is defined as
1 𝑁𝑁
𝜇𝜇𝐴𝐴 = 𝑁𝑁
�𝑘𝑘=1 𝐴𝐴(𝑘𝑘), where N is the length of the vector.
2) (10 points) Use the sum ( ) function to find the variance of the vector, which is defined as
1 𝑁𝑁
𝜎𝜎𝐴𝐴2 = 𝑁𝑁
�𝑘𝑘=1(𝐴𝐴(𝑘𝑘) − 𝜇𝜇𝐴𝐴 )2.
Consider the 5x5 magic matrix B given by the magic(5) function in Matlab.
The Discrete Cosine Transform (DCT) is the most widely used linear transform in image and
video compression. It is used in popular compression standards such as JPEG, H.264, H.265, and
H.266.
The DCT is a matrix with closed-form expression for any size M x M. Let T be the M x M DCT
matrix, and X be a M x M data matrix, then the one-dimensional DCT transform of X is defined
as:
Y1 = T * X,
Y2 = T * X * T’,
1 2 3 4
7) Let 𝑋𝑋4 = �1 2 3 4� . Find T4 * X4.
1 2 3 4
1 2 3 4
8) Find T4 * X4 * T4’.
9) Find the sum of each row of the 4x4 DCT matrix T4.
10) No programming is needed: Discuss the symmetry of each row in the DCT matrix T4.