2021_M_sol (1)

pdf

School

McMaster University *

*We aren’t endorsed by this school

Course

2CR3

Subject

Electrical Engineering

Date

Jan 9, 2024

Type

pdf

Pages

11

Uploaded by UltraBraveryGoat3

Report
MCMASTER UNIVERSITY Department of Electrical and Computer Engineering October 29, 2021 COMP ENG 4TL4 and ECE 6TL4 (Digital Signal Processing) Instructor: Dr. Ratnasingham Tharmarasa MIDTERM TEST Duration: 2 hours This is an open book exam. This examination paper consists of 11 pages and 5 questions. The number in brackets at the start of each question is the number of points the question is worth. Answer all questions. Answer each question on a separate letter-size paper. All answers must be hand-written. Write your name and student number on each page. Use the following naming convention for your files: StudentNumber QuestionNumber (e.g., 400654321 Q2). If you have answered on more than one page for a question, then the name of the second page should be StudentNumber QuestionNumber PageNumber (e.g., 400654321 Q2 p2). You may choose to upload only one file with all the answers. Then, use your student number to name your file. Please, do not zip your file/files, in order to make easier the job of the TAs who will mark the exam. Upload a scanned copy or clear photos of answer sheets to avenue by 9:00 pm on Oct 29, 2021. Academic integrity statement: By submitting this work, I certify that the work represents solely my own independent efforts. I confirm that I am expected to exhibit honesty and use ethical behaviour in all aspects of the learning process. I confirm that it is my responsibility to understand what constitutes academic dishonesty under the Academic Integrity Policy. Page 1 of 11
page 2 Numbers from Student Number Fill in the following table to use the values from this table whenever you see a number start with “#” in any of the questions. Example: If the student number is 400123456, D 1 = 6, D 2 = 5, D 3 = 4, D 4 = 3, D 5 = 2, D 6 = 1. Digits D9 D8 D7 D6 D5 D4 D3 D2 D1 Your student number
page 3 1. (a) [7] The sequence x [ n ] = cos(0 . 2 πn ) was obtained by sampling the continuous-time signal x c ( t ) = cos(2 πf 0 t ) at a sampling rate of 5000 samples/s. What are two possible values of f 0 that should have resulted in the sequence x [ n ]? Provide one more possible value with f 0 > (12000 + # D 4 1000) Hz. Answer: 2 πf 0 n/ 5000 = (2 πk + π/ 5) n, k = . . . , 1 , 0 , 1 , 2 , . . . (1) f 0 = 5000( k + 1 / 10) k = . . . , 1 , 0 , 1 , 2 , . . . (2) Also, 2 πf 0 n/ 5000 = (2 πk π/ 5) n, k = . . . , 1 , 0 , 1 , 2 , . . . (3) f 0 = 5000( k 1 / 10) k = . . . , 1 , 0 , 1 , 2 , . . . (4) Possible values 500, 5500, 4500, 20500 (b) [8] Students were asked to develop a uniform quantizer with 2 b levels for a signal with 99% of the values between 5 to 5 and the max value 10. Student 1 did the quantization for scale 10 to 10, and Student 2 did the quantization for scale 5 to 5? Analyze the pros and cons of both quantization scales. Provide the optimization criteria under which each method is better than the other. Answer: 10 to 10 scaling: No clipping Max error is small Average error is high optimization criteria: minimize max error 5 to 5 scaling: Clipping Max error is high Average error is low Optimization criteria: minimize average error (c) [5] A signal is sampled with a sampling interval T s and quantized to 2 (# D 3 mod 4)+3 levels. What should be the value of sampling interval T s to get bit rate 1024 bits/s? Answer: # D 3 = 6 Bits per sample is (6mod4) + 3 = 5. Samples per second is 1 /T s . Hence, 1 T s 5 = 1024 (5) T s = 5 / 1024 (6)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
page 4 2. (a) [8] Consider a system with transfer function h [ n ] = δ [ n ] δ [ n (3 + # D 3)]. Answer: # D 3 = 5 h [ n ] = δ [ n ] δ [ n 8] i. Provide a possible input signal x [ n ] that produces the output y [0] = 1 and y [(3+# D 3)] = 3. Note that we do not care about the output values at other n ’s. Answer: y [0] = x [0] x [ 8] Since y [0] = 1, let x [0] = 1 and x [ 8] = 0. y [8] = x [8] x [0] Since we assume x [0] = 1, x [8] should be y [8] + x [0] = 3 + 1 = 4. Hence, one possible input signal x [ n ] = δ [ n ] + 4 δ [ n 8] ii. What is the output of input x [ n ] = δ [ n +(3+# D 3)]+ δ [0]+ δ [ n (3+# D 3)]? Answer: x [ n ] = δ [ n + 8] + δ [ n ] + δ [ n 8] y [ 8] = 1 y [0] = 1 1 = 0 y [8] = 1 1 = 0 y [16] = 0 1 = 1 Otheriwse zero There is a typo: δ [0] is there instead of δ [ n ]. In this case, x [ n ] = δ [ n + 8] + δ [0] + δ [ n 8] = 1 + δ [ n + 8] + δ [ n 8] y [ 8] = 1 y [0] = 1 2 = 1 y [8] = 2 1 = 1 y [16] = 1 2 = 1 Otheriwse 0 (b) [5] Consider the following difference equation: y [ n ] 2 y [ n 1] = x [ n 1] + x [ n + 1] (7) i. What is y [3] for x [ n ] = δ [ n 2] with y [1] = 2? Answer: y [2] 2 y [1] = x [1] + x [3] (8) y [2] = 4 + 0 + 0 = 4 (9) y [3] 2 y [2] = x [2] + x [4] (10) y [3] = 8 + 1 + 0 = 9 (11) ii. Is this system causal? Justify your answer.
page 5 Answer: No, output at n depends on the future input at n + 1. (c) [7] In Lab 2, you were asked to find the convolution x a [ n ] h 1 [ n ] for x a [ n ] = 5 cos(0 n ) = 5 (12) h 1 [ n ] = 0 . 25 δ [ n ] + 0 . 5 δ [ n 1] + 0 . 25 δ [ n 2] (13) Here is the MATLAB help for conv command: C = conv(A, B, SHAPE) returns a subsection of the convolution with size specified by SHAPE: ‘full’ - (default) returns the full convolution, ‘valid’ - returns only those parts of the convolution that are computed without the zero-padded edges. The results obtained by two students using the MATLAB convolution are shown in Fig. 1 and 2. The size of x a is 51 (i.e., n =0:1:50) and the size of h 1 is 3. The length of the output with the ‘SHAPE’ option ‘full’ is 53 and the length of the output with ‘SHAPE’ option ‘valid’ is 49. Justify the reason to get only 49 values with SHAPE option ‘valid’ . You need to mention the index of the first value of the output. Note that the x-axis is not n . You need to find the n from the MATLAB output sequence. Answer: The value of signa x a is known only for n=0:51. In order to find y [0] we need to know x a [ 1] and x a [ 2], hence we cannot find y [0]. Similarly, we cannot find y [1] since we do not know x a [ 1]. We can find the output at n = 2 : 50. We cannot find y [51] since x a [51] is unknown. Hence, we can find the output only at n = 2 : 50. That is why length of the output is 49 with option ’valid’.
page 6 1 2 3 4 5 6 conv(x a ,h 1 ,'full') 0 10 20 30 40 50 60 Figure 1 . Convolution obtained by student 1 using MATLAB command ‘conv( x a , h 1 , ‘full’)’ . 1 2 3 4 5 6 conv(x a ,h 1 ,'valid') 0 10 20 30 40 50 60 Figure 2 . Convolution obtained by student 2 using MATLAB command ‘conv( x a , h 1 , ‘valid’)’ .
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
page 7 3. (a) [5] A continous time signal x ( t ) = cos(2 π 1000 t ) is sampled at a sampling rate 4000 samples/s. Plot the magnitude of DTFT (i.e., | H ( ω ) | ) of the sampled signal. Answer: 4000 Hz is 2 π in ω . So, 1000 Hz is π/ 2. x [ n ] = cos( π 2 n ) = 0 . 5( e + j π 2 n + e - j π 2 n ) (14) = 1 2 π (2 π 0 . 5( e + j π 2 n + e - j π 2 n )) (15) = 1 2 π ( π ( e + j π 2 n + e - j π 2 n )) (16) (17) Hence, | X ( ω ) | = π ω = π/ 2 π ω = π/ 2 0 otherwise (18) (b) [5] DTFT of a real signal is X ( ω ) = braceleftbigg (1 + # D 2) e j 0 . 5 for 0 ω < π/ 4 (2 + # D 2) e - j 0 . 1 for π/ 4 ω < π (19) Plot both magnitude and phase of X ( ω ) for ω = [ π, 3 π ]. If you need more information, list the information required. Answer: # D 2 = 3 Since the signal is real, | X ( ω ) | = | X ( ω ) | and (Phase( X ( ω )) = Phase( X ( ω )). Also, X ( ω ) is periodic with period 2 π . Hence, | X ( ω ) | = 5 for π ω ≤ − π/ 4 4 for π/ 4 < ω < π/ 4 5 for π/ 4 ω π 5 for π < ω 2 π π/ 4 4 for 2 π π/ 4 < ω < 2 π + π/ 4 5 for 2 π + π/ 4 ω < 3 π (20) Phase( X ( ω )) = 0 . 1 for π ω ≤ − π/ 4 0 . 5 for π/ 4 < ω < 0 0 . 5 for 0 ω < π/ 4 0 . 1 for π/ 4 ω π 0 . 1 for π ω 2 π π/ 4 0 . 5 for 2 π π/ 4 < ω < 2 π 0 . 5 for 2 π ω < 2 π + π/ 4 0 . 1 for 2 π + π/ 4 ω 3 π (21)
page 8 (c) [10] DTFT of a continuous-time signal sampled at the sampling rate f s , which is higher than the Nyquist rate, is X ( ω ) = 1 + # D 2 , | ω | ≤ π/ 2 (1 + # D 2) , π/ 2 < | ω | ≤ 3 π/ 4 0 , 3 π/ 4 < | ω | < π (22) i. Sketch the magnitude of DTFT obtained when the signal is sampled at twice of the original rate (i.e., 2 f s ). Show your work . Answer: # D 2 = 4 X ( ω ) = 5 2 , | ω | ≤ π/ 4 5 2 , π/ 4 < | ω | ≤ 3 π/ 8 0 , 3 π/ 8 < | ω | < π (23) ii. Sketch the magnitude of DTFT obtained when the signal is sampled at half of the original rate (i.e., f s / 2). Show your work . Answer: # D 2 = 4 Without considering aliasing: X ( ω ) = 5 / 2 , | ω | ≤ π 5 / 2 , π < | ω | ≤ 3 π/ 2 0 , 3 π/ 2 < | ω | < 2 π (24) After considering the aliasing: X ( ω ) = braceleftbigg 5 / 2 , | ω | < π/ 2 0 , π/ 2 ≤ | ω | < π (25)
page 9 4. (a) [5] Find the z -transform of the signal x [ n ] = δ [ n +2] δ [ n 4]+(2+# D 2) u [ n 2]? Answer: # D 2 = 3 X ( z ) = z 2 z - 4 + 5 z - 2 1 - z - 1 with ROC | z | > 1 excluding infinity. (b) [5] Write an impulse response h [ n ] with ROC 0 . 2 < | z | < 3 and h [ 2] = 0. Answer: h [ n ] = 0 . 2 n u [ n ] 3 n u [ n 1] + [ n + 2] Since h [ 2] = 0, a = 0 0 + 3 - 2 = 1 / 9 Or, h [ n ] = 0 . 2 n u [ n ] 3 n u [ n 3] (c) [10] Consider a stable system with the transfer function: H ( z ) = 6 z - 2 1 2 z - 1 (26) i. Find the impulse response h [ n ] of the above system. If we cannot find the answer without additional informtion, list the information that you need. Answer: Since, the system is stable, ROC includes unit circle. Invere z -transform of 1 1 - 2 z - 1 is 2 n u [ n 1] Hence, inverse of H ( z ) is h [ n ] = 6 2 n - 2 u [ ( n 2) 1]. ii. Is this system causal? Justify your answer. Answer: No, ROC does not include infinity or h [ n ] negationslash = 0 for n < 0. (d) [5] Find the system transfer function H ( z ) of the following LCCD equation? y [ n ] = y [ n 2] y [ n 3] + 2 x [ n + 1] 3 x [ n 1] (27) Answer: Y ( z ) z - 2 Y ( z ) + z - 3 Y ( z ) = 2 z 1 X ( z ) 3 z - 1 X ( z ) (28) Y ( z )(1 z - 2 + z - 3 ) = X ( z )(2 z 1 3 z - 1 ) (29) H ( z ) = Y ( z ) X ( z ) = 2 z 1 3 z - 1 1 z - 2 + z - 3 (30)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
page 10 5. (a) [7] Consider the following signal x [ n ] = (# D 3 + 1) δ [ n ] + (# D 2 + 1) δ [ n 3]. i. Find the 4-point DFT of the above signal. Answer: # D 3 = 4 , # D 2 = 2 x [ n ] = 5 δ [ n ] + 3 δ [ n 3] X [ k ] = 3 summationdisplay n =0 x [ n ] e - j 2 π 4 kn (31) = x [0] + x [3] e - j 2 π 4 3 k (32) = 4 + 3 e - j 2 π 4 3 k (33) ii. If we find 8-point DFT of the above signal with zero-padding and then find the inverse DFT ¯ x [ n ], what will be the value at n = 6, i.e., ¯ x [6]? Answer: After zero padding, we consider the signal x [ n ] = [4 , 0 , 0 , 3 , 0 , 0 , 0 , 0]. If we find the DFT of this signal and find the inverse DFT, we will get the same signal. So, ¯ x = 0. (b) [8] 8-point DFT of a finite length ( M < 8) sequence signal is X [ k ] = { 16 , 14 , 12 , 10 , 8 , 6 , 4 , 2 } (34) i. What is the value of 32-point DFT at k = 12 of the same signal with zero- padding? Answer: The value of 32-point DFT at k = 12 is same as the value of 8-point DFT at k = 12 / 4 = 3, which is 10. ii. How would you find the value of 32-point DFT at k = 12 + (# D 1 mod 3) + 1 of the same signal with zero-padding? You do not need to find the value, but need to explain the steps. Answer: # D 1 = 2 k = 12 + 2 + 1 = 15 k = 15 is not an integer multiple of 4. Hence, DFT at k = 15 cannot be directly found. We can find the x [ n ] using 8-point inverse DFT, and then use the 32-DFT equation to find the 32-point DFT value at k = 15. iii. How would you find the value of 32-point DFT at k = 64 + (# D 1 mod 3) + 1 of the same signal with zero-padding? You do not need to find the value, but need to explain the steps. Answer: # D 1 = 2
page 11 k = 64 + 2 + 1 = 67 Since DFT is periodic 32-point DFT at k = 67 is equal to value at k = 3. k = 3 is not an integer multiple of 4. Hence, DFT at k = 3 cannot be directly found. We can find the x [ n ] using 8-point inverse DFT, and then use the 32-DFT equation to find the 32-point DFT value at k = 3. End of examination Total pages: 11 Total marks: 100