SIGNALS AND SYSTEMS LABORATORY. Properties of the

determined in Matlab using the command ... subplot(2,1,2);stem(n,y);title('circularly folded sequence'); ... subplot(2,2,1);stem(n,real(X));title('Real part of DFT of.
40KB taille 6 téléchargements 413 vues
Signals and Systems Laboratory, School of Control Systems and Electrical Engineering. ________________________________________________________________________

DT021/4:

SIGNALS AND SYSTEMS LABORATORY.

Properties of the Discrete Fourier Transform (DFT) II The objective of this lab is to investigate the application of the DFT to the calculation of convolution and correlation. Objectives: 1. To investigate the circular folding and circular time shift properties of the DFT 2. To understand the use of the moduloN operator in the manipulation of circular data sequences. 3. To implement a range of programmes to carry out convolution between sequences 4. To verify the use of the DFT to carry out convolution. 5. To modify the programmes to carry out correlation. Procedure: Circular Folding. The perodocity of the DFT transform pair means that the sequence of N numbers can be viewed of as a circle of numbers. 0

10

1

9 2

8

3

4

7 6

5

Modulo arithmetic allows the manipulation of circular arrays of numbers as shown in the diagram. The Modulo-N operation, where N is the length of the sequence, on the argument –n and written ((-

____________________________________________________________________________ Signals and Systems Laboratory/rgh,wtg/Nov 2003

Signals and Systems Laboratory, School of Control Systems and Electrical Engineering. ________________________________________________________________________

n))N , circularly reverses the original sequence n. and is determined in Matlab using the command mod(-n,N). Consider the following commands for the sequence n= 0:17, ie N = 18, for the circular array shown >> n n= Columns 1 through 11 0 1 2 3 4 5

6

7

8

>> mod(-n,N) ans = Columns 1 through 11 0 10 9 8 7 6

5

4

3

9

2

10

1

>> mod(-n,N)+1 % Since ‘n’ is to be used as an index we must add 1 ans = Columns 1 through 11 1

11

10

9

8

7

6

5

4

3

2

Example: Let x(n) = 10(0.8) n ,0 ≤ n ≤ 10 (a) Determine and plot x((-n))N . (b) Verify the Circular folding property. Answer N=11; n=0:N-1;x=10*(0.8).^n;y=x(mod(-n,N)+1); subplot(2,1,1);stem(n,x);title('original sequence'); xlabel('n');ylabel('x(n)'); subplot(2,1,2);stem(n,y);title('circularly folded sequence'); xlabel('n');ylabel('y(n)'); X=fft(x,N);Y=fft(y,N); subplot(2,2,1);stem(n,real(X));title('Real part of DFT of original Sequence'); ____________________________________________________________________________ Signals and Systems Laboratory/rgh,wtg/Nov 2003

Signals and Systems Laboratory, School of Control Systems and Electrical Engineering. ________________________________________________________________________

subplot(2,2,2);stem(n,imag(X));title('Imaginary part of DFT of original Sequence'); subplot(2,2,3);stem(n,real(Y));title('Real part of DFT of foldedSequence'); subplot(2,2,4);stem(n,imag(Y));title('Imaginarypart of DFT of foldedSequence'); Circular Time Shift. We again have the data in a circular (periodic) sequence. For x(n-l) the data is shifted clockwise by l points 9

10

8 0

10

1

7 0

9 2

8

6

4

7

5

1

3

6

2

5 3

4

The circular shift can be implemented using the Modulo operation already used. A Matlab function can be written: function y = circshift(x,m) N = length(x); x = [x zeros(1,N-length(x))]; n = [0:N-1]; n = mod(n-m,N); y = x(n+1); Now use this Matlab function to draw the data for x(n) = 10(0.8) n ,0 ≤ n ≤ 10 shifted by say 4 points.

subplot(3,1,1);stem(n,x); title('original data') subplot(3,1,3);x2=circshift(x,6);stem(n,x2);title('delayed by 6') subplot(3,1,2);x1=circshift(x,3);stem(n,x1);title('delayed by 3') ____________________________________________________________________________ Signals and Systems Laboratory/rgh,wtg/Nov 2003

Signals and Systems Laboratory, School of Control Systems and Electrical Engineering. ________________________________________________________________________

The DFT of a circularly shifted sequence is given by DFT [x((n − m)) N ] = W Nkm X ( k )

Exercise. (a) (b)

Calculate the DFT of the sequence x = [1 1 0 0]. Use the result above to determine the DFT of x1 = [0 1 1 0]. Programmes to carry out Convolution. 1.

Using double loops: (his programme is not working. See if you can get it to work.)

%function y=linconvsum(x,h) x=[1 2 3];h=[3 -2 1]; Nx=length(x); Nh=length(h);Ny=Nx+Nh-1; y=zeros(1,Ny); h=[h zeros(1,Nx-1)];x=[x zeros(1,Nh-1)] for n=0:Ny-1 sum=0 for m=0:Ny-1 sum=sum+x(m+1)*h(n-m+1); end y(n+1)=sum end

2.

Usematrix Formulation for convolution

3.

Use DFT

____________________________________________________________________________ Signals and Systems Laboratory/rgh,wtg/Nov 2003