Professional Documents
Culture Documents
20EE10083 DSP Exp7
20EE10083 DSP Exp7
20EE10083 DSP Exp7
Bharat Uday
20EE10083
First create a Hamming window x of length N = 20, using the Matlab command x = ham-
ming(20). Then use your matlab function DFTsum to compute the 20 point DFT of x. suited
for numerical evaluation on computers
Lab Report:
Hand in the plot of the |X20 [k]|—. Circle the regions of the plot corresponding to low frequency
components.
The matlab plot of magnitude of 20 point hamming window:
Write a Matlab function to compute samples of the DTFT and their corresponding frequencies
in the range - π to π
Use your function DTFTsamples to compute DTFT samples of the Hamming window of length
N = 20. Plot the magnitude of these DTFT samples versus frequency in rad/sample.
Lab Report:
1. Hand in the code for your function DTFTsamples.
2. Hand in the plot of the magnitude of the DTFT samples
1
6 [ X_dft ]= DFTsum ( x ) ;
7 X = fftshift ( X_dft ) ;
8 w = fftshift ( w1 ) ;
9 end
The Matlab Plot of the magnitude of DTFT samples of the Hamming window:
In the following, you will compute the DTFT samples of x[n] using both N = 50 and N = 200
point DFT’s. Notice that when N = 200, most of the samples of x[n] will be zeros because x[n]
= 0 for n 50. This technique is known as “zero padding”, and may be used to produce a finer
sampling of the DTFT.
For N = 50 and N = 200, do the following:
1. Compute the vector x containing the values x[0], . . . , x[n 1].
2. Compute the samples of X[k] using your function DTFTsamples.
3. Plot the magnitude of the DTFT samples versus frequency in rad/sample
Lab Report:
1. Submit your two plots of the DTFT samples for N = 50 and N = 200.
2. Which plot looks more like the true DTFT?
3. Explain why the plots look so different.
The Matlab Plot of the magnitude of DTFT samples for N=50 and N=200:
2
The plot for N=200 is more like DTFT , this is because of the finer sampling due to zero
padding.
We have seen in the preceding sections that the DFT is a very computationally intensive
operation. In 1965, Cooley and Tukey1 published an algorithm that could be used to compute
the DFT much more efficiently. Various forms of their algorithm, which came to be known as
the fast Fourier transform (FFT).
Test your function dcDFT by using it to compute the DFT’s of the following signals.
Lab Report:
Do the following:
1. Submit the code for your function dcDFT.
2. Determine the number of multiplies that are required in this approach to computing an N
point DFT.
3
3 j = sqrt ( -1) ;
4 k =0: N /2 -1;
5 x0 = x (1:2: N ) ;
6 x1 = x (2:2: N ) ;
7 [ X0 ]= DFTsum ( x0 ) ;
8 [ X1 ]= DFTsum ( x1 ) ;
9 W_N = exp ( - j *2* pi .* k / N ) ;
10 X_k = X0 + W_N .* X1 ;
11 X_k_2 = X0 - W_N .* X1 ;
12 X =[ X_k X_k_2 ];
13 end
4
1 function [ X ] = FFT2 ( x )
2 X (1) = x (1) + x (2) ;
3 X (2) = x (1) -x (2) ;
4 end
9 [ X0 ]= FFT2 ( x0 ) ;
10 [ X1 ]= FFT2 ( x1 ) ;
11
12 X_k = X0 + W_N .* X1 ;
13 X_k_2 = X0 - W_N .* X1 ;
14
15 X =[ X_k X_k_2 ];
16
17 end
9 [ X0 ]= FFT4 ( x0 ) ;
10 [ X1 ]= FFT4 ( x1 ) ;
11
12 X_k = X0 + W_N .* X1 ;
13 X_k_2 = X0 - W_N .* X1 ;
14
15 X =[ X_k X_k_2 ];
16
17 end
5
Yes, the results are same as previous results for 8 point dft
Write a recursive function X = ffts tage(x)thatperf ormsonestageof theF F T algorithmf orapower−
of − 2lengthsignal.
15 X_k = X0 + W_N .* X1 ;
16 X_k_2 = X0 - W_N .* X1 ;
17
18 X =[ X_k X_k_2 ];
19
20 end
21
22 end