Coding and transformation EE040-4-3-CT (Individual Assignment) Student Name: Maxime Frédéric FABRE Student Number/ID: TP029408 Submission Date: 08/11/2012 Maxime FABRE TP029408 Coding and transformation Individual Assignment EE020-4-3-NP UCFEFREI1209 Exercice 1 : The Linear convolution of two sequences x(n) & h(n) is given by, y(n) = x(n) * h(n) = x(k ).h(n k ) k The circular convolution of two sequences x(n) & h(n) is defined by, N 1 y(m) = x (k ).h ((m k )) k 0 N Where x(n) – input sequence; h(n) – impulse response; y(n), y(m) – output sequence. Given: x(n) = [1,1,1,2,1] and h(n) = [1,1,2,1] So, as we learn during the lectures, the linear convolution output function is defined as : 𝒀(𝒏) = 𝒙(𝒏) × 𝒉(𝒏) Where x(n) and h(n) are the linear input sequences. The linear convolution can be done using two different methods: Tabulation Method Matrix Method We are going to solve the problem with one of these two methods, more precisely Tabulation method and after we will verify the result using a MATLAB program. Page 2 Maxime FABRE TP029408 Coding and transformation Individual Assignment EE020-4-3-NP UCFEFREI1209 1) Linear convolution We’re going to resolve the linear convolution with the tabulation method. However we could have been done the matrix method. 𝑥(𝑛) = [1,1,1,2,1] ℎ(𝑛) = [1,1,2,1] h(n) 1 1 2 1 1 1 1 2 1 1 1 1 2 1 2 2 2 4 2 1 1 1 2 1 x(n) 1 1 1 2 1 Then, we add the diagonals in order to have the final answer: First Diagonal: y(1) = 1 Second diagonal: y(2) = 1+1 = 2 Third Diagonal: y(3) = 1+1+2 = 4 Fourth Diagonal: y(4) = 2+1+2+1 = 6 Fifth diagonal: y(5) = 1+2+2+1 = 6 Sixth Diagonal: y(6) = 1+4+1 = 6 Seventh Diagonal: y(7) = 2+2 = 4 Eight Diagonal: y(8) = 1 So, the output sequence y(n) = {1,2,4,6,6,6,4,1} Let’s check the results by Matlab: x=[1,1,1,2,1]; h=[1,1,2,1]; conv(x,h) Result Page 3 Maxime FABRE TP029408 Coding and transformation Individual Assignment 2) Circular convolution 𝟏 𝟏 ( 𝟐 𝟏 𝟏 𝟏 𝟏 𝟐 𝟐 𝟏 𝟏 𝟏 𝟏 𝟐 𝟏 𝟏 𝟏 𝟏 ) * 𝟐 𝟏 𝟏 𝟕 𝟏 𝟖 𝟏 = ( ) 𝟖 𝟐 𝟕 (𝟏) The output sequence y(n) = {7, 8, 8, 7} Program Matlab: x=[1,1,1,2,1]; h=[1,1,2,1]; cconv(x,h,4) Results obtained by Matlab: The execution time of linear convolution is faster than the circular convolution. Page 4 EE020-4-3-NP UCFEFREI1209 Maxime FABRE TP029408 Coding and transformation Individual Assignment EE020-4-3-NP UCFEFREI1209 Exercice 2 To resolve the problem we have to put the sequence in bit reversed order. The sequence X(n) in bit reversed order : X(0) = 2 X(4) = 1 X(2) = 2 X(6) = 1 X(1) = 2 X(5) = 1 X(3) = 2 X(7) = 1 In order to continue the problem, we have to identify how many stages we need. As we have 8 points, we require 3 stages of computation. In the first stage we have only 𝑊20 First stage Computation: The input sequence for the first stage is {2,1,2,1,2,1,2,1}. A = a + b 𝑊𝑁𝑛𝑘 B = a - b 𝑊𝑁𝑛𝑘 X(0) = 2 2+1=3 X(1) = 2 2+1=3 X(4) = 1 2-1=1 X(5) = 1 2-1=1 X(2) = 2 2+1=3 X(3) = 1 2+1=3 X(6) = 1 2-1 =1 X(7) = 2 2-1=1 So, now we have this input sequence after the first stage {3,1,3,1,3,1,3,1}. According to the lecture, in the second stage computation, we have 𝑊40 and 𝑊41 . Page 5 Maxime FABRE TP029408 Coding and transformation Individual Assignment EE020-4-3-NP UCFEFREI1209 Second stage Computation 3 3+3=6 1 6 1 1+1(-j) =1-j 3 1-j 3 3-3 = 0 1 0 1 1 – 1(-j) = 1 + j 3 1+j After the second stage computation, the output DFT sequence is: {6,1-j,0,1+j,6,1-j,0,1+j} Now, we have to take this sequence and put it as the input sequence in the third stage computation. Moreover, the phase factors involved in third stage computation are𝑊80 , 𝑊81 , 𝑊82 and 𝑊83 . 𝑊80 = 1, 𝑊81 = 0.707 − 0.707𝑗, 𝑊82 = −𝑗, 𝑊83 = −0.707 − 0.707𝑗 Third stage Computation 6 6+6=12 1-j (1-j) + (1-j) * (0.707-0.707j) = 1 - 2.414j 0 0+0 (-j) = 0 1+j (1+j) + (1+j) * (-0.707-0.707j) =1 - 0.414j 6 6-6=0 1-j (1-j) - (1-j) * (0.707-0.707j) = 1 + 0.414j 1 0-0(-j) = 0 1+j (1+j) - (1+j) * (-0.707-0.707j) = 1 + 2.414j So, we obtain finally the output sequence :{12, 1-2.414j, 0, 1-0.414j, 0, 1+0.414j, 0, 1+2.414j} this is the final solution : Page 6 Maxime FABRE TP029408 Coding and transformation Individual Assignment X(n) = {12, 1-2.414j, 0, 1-0.414j, 0, 1+0.414j, 0, 1+2.414j } Now, we have to verify these results with MATLAB program: disp('FFT of x(n)=[2,2,2,2,1,1,1,1'); x=[2,2,2,2,1,1,1,1]; y=fft(x,8); disp(y); Let’s look the result obtained by Matlab. We obtain the same results, so there is no problem Exercice 3: Figure Q3 Page 7 EE020-4-3-NP UCFEFREI1209 Maxime FABRE TP029408 Coding and transformation Individual Assignment EE020-4-3-NP UCFEFREI1209 2 𝑖𝑓 0 < 𝑥 < 10 0 𝑖𝑓 10 < 𝑥 < 20 x(t) = { ∞ 𝑋(𝑗𝑤) = ∫ 𝑥(𝑡)𝑒 −𝑗𝑤𝑡 𝑑𝑡 −∞ 10 20 𝑋(𝑗𝑤) = ∫0 2𝑒 −𝑗𝑤𝑡 dt + ∫10 𝑥(𝑡)𝑒 −𝑗𝑤𝑡 𝑑𝑡 10 𝑋(𝑗𝑤) = ∫0 2𝑒 −𝑗𝑤𝑡 dt 𝑋(𝑗𝑤) = − 𝑋(𝑗𝑤) = − 𝑋(𝑗𝑤) = − 2 × (𝑒 −10𝑗𝑤 − 1) 𝑗𝑤 2 × (𝑒 −5𝑗𝑤 ∗ 𝑒 5𝑗𝑤 − 1) 𝑗𝑤 2 𝑒 −5𝑗𝑤 − 𝑒 5𝑗𝑤 ×( ) 𝑗𝑤 𝑒 5𝑗𝑤 𝑋(𝑗𝑤) = − 𝑋(𝑗𝑤) = 2 10 × [𝑒 −𝑗𝑤 ]0 𝑗𝑤 2 × (− 𝑒 −5𝑗𝑤 + 𝑒 5𝑗𝑤 ) 𝑗𝑤𝑒 5𝑗𝑤 4 𝑒 5𝑗𝑤 − 𝑒 −5𝑗𝑤 𝑋(𝑗𝑤) = ×( 𝑤𝑒 5𝑗𝑤 𝑋(𝑗𝑤) = 4 × sin(5𝑤) 𝑤𝑒 5𝑗𝑤 𝑋(𝑗𝑤) = 2𝑗 4 −5𝑗𝑤 𝑒 × sin(5𝑤) 𝑤 Program Matlab: syms t; syms w; f = int((2*exp(-i*w*t)),t,0,10) Page 8 )