The Discrete Fourier Transform problem set with solutions, Exercises of Signal Processing and Analysis

Problem set with solutions on The Discrete Fourier Transform

Typology: Exercises

2019/2020

Uploaded on 04/30/2020

anala
anala 🇺🇸

4.3

(15)

259 documents

1 / 11

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
MIT OpenCourseWare
http://ocw.mit.edu
2.161 Signal Processing: Continuous and Discrete
Fall 2008
For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download The Discrete Fourier Transform problem set with solutions and more Exercises Signal Processing and Analysis in PDF only on Docsity!

MIT OpenCourseWare http://ocw.mit.edu

2.161 Signal Processing: Continuous and Discrete

Fall 2008

For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.

MASSACHUSETTS INSTITUTE OF TECHNOLOGY

DEPARTMENT OF MECHANICAL ENGINEERING

2.161 Signal Processing - Continuous and Discrete Fall Term 2008

Problem Set 5: The Discrete Fourier Transform

Assigned: October 16, 2008 Due: October 23, 2008

Problem 1: A 128 millisecond portion of an analog signal is sampled at a rate of 8 kHz and the resulting L samples are saved for further processing. What is L? The 256 point DFT of these samples is computed. What is the frequency spacing in Hz of the computed DFT values? What is the total number of required multiplications

(a) if the computations are done using the DFT directly, and

(b) if the computations are done using a FFT?

What is the scale factor relating frequency domain samples Fm in the FFT to the value of the Fourier transform F (jω) at the same frequency?

Problem 2: A 10 kHz sinusoidal signal is sampled at 80 KHz. A total of 64 samples are collected and used to compute the DFT of the signal. At what DFT indices, k = 0, 1 ,... , N − 1 would you expect to see any peaks in the DFT?

Problem 3: Compute the 8 point FFT of the 8 sample sequence.

{x} = [5, − 1 , − 3 , − 1 , 5 , − 1 , − 3 , −1]

(Show your decomposition and recombination.) Verify your answers using Matlab’s FFT function. Noting that these samples are the first 8 samples of x(n) = 4 cos(πn/2) + cos(πn), discuss whether the 8-point FFT values represent the expected spectrum of {xn}. What FFT indices correspond to the two frequencies of the cosinusoids?

Problem 4: (Proakis & Manolakis – Prob. 7.1)

Problem 5: (Proakis & Manolakis – Prob. 7.3)

Problem 6: Use Matlab to explore off-line filtering of data by manipulation of the FFT of a noisy signal as follows:

(a) Create a “noisy” signal of length 1024 in Matlab as follows: t=[0:.01:10.23]; f = exp(-t).sin(10t); noise=rand(1,1024); signal = f + noise;

MIT OpenCourseWare http://ocw.mit.edu

2.161 Signal Processing: Continuous and Discrete

Fall 2008

For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.

MASSACHUSETTS INSTITUTE OF TECHNOLOGY

DEPARTMENT OF MECHANICAL ENGINEERING

2.161 Signal Processing - Continuous and Discrete Fall Term 2008

Solution of Problem Set 5: The Discrete Fourier Transform

Assigned: October 16, 2008 Due: October 23, 2008

Problem 1:

Given a signal of duration T = 0.128 ms, sampled at a rate of Fs = 8 kHz, the number of samples is L = T fs = 1024. If only 256 samples are taken, the frequency spacing in the computed DFT is Δf = fs/N = 31.25 Hz.

(a) The number of multiplications required for the direct computation of the DFT is N 2 = 256^2 = 65 , 536.

(b) The number of multiplications required for the computation of the DFT using the FFT is N/2 log 2 (N ) = 128 × 8 = 1024.

Note that Fm = F ∗(j (^) N^2 πm ΔT^ ) = F ∗(j 2 πfs mN^ ). Hence, the mth^ component of the DFT corresponds to the actual frequency of mN^ fs = mΔf = 31. 25 m Hz.

f (t) = 1 +∞^ jΩtdΩ 2 π −∞ F^ (jΩ)e N − 1 fn = f (nΔt) = (^) N^1

Fmej^

mn (^2) π N m= Comparing above formulas, we can realize that, if there is a ONE-TO-ONE correspondence between discrete values of Fm and continuous values of F (jΩ), then at Ω = 2πfs mN^ the F (jΩ) is a delta function with an amplitude equal to (^2) N^ π^ Fm. This can be verified for example for either a DC signal or a sine signal without spectral leakage. Note that to find the scale factor, we cannot use the relation between F and F ∗^ (F ∗(jΩ) =

1 n=+∞^1 n=+∞ F (j(Ω − n 2 πfs)) = F (j(Ω − nΩs)) ). That’s because in relating Fm to F ∗, we ΔT (^) n=−∞ ΔTn=−∞

assumed that the rest of the sample points are zero. On the other hand, DFT assumes that the f (t) is a periodic extension of the sampled data with period N ΔT.

Problem 2:

A fc = 10 kHz sinusoidal signal is sampled at fs = 80 kHz, and a total of N = 64 samples are taken to compute the DFT of the signal. The period of the signal is T = 1/ 104 = 0.1 ms, and the sampling period is ΔT = 1/fs = 1/(80 · 103 ) = 12. 5 μsec. Then 64 samples will contain 8 whole periods of the signal ( 64 ∗ 12. 5 μsec ∗10kHz= 8 cycle ). Therefore, there is no spectral leakage. The frequency spacing of the DFT would be Δf = 1/(N ΔT ) = 1/(64 × 12. 5 · 10 −^6 ) = 1250 Hz, so we would expect to see one peak in the DFT {Fm} at m 1 = fs/fc = 8 and the other peak at m 2 = N − m 1 = 56. The following MATLAB verifies this.

n=[0:63]; DT=1/(801e3); f=sin(2piDT10000*n); stem(n,abs(fft(f)))

we can construct the following table:

Data 2-point DFTs 4-point DFTs 8-point DFT x 0 = 5 x 0 + x 4 = 10 10 + W 80 · (−6) = 4 4 + W 80 · (−4) = 0 = X 0 x 4 = 5 x 0 − x 4 = 0 0 + W 82 · 0 = 0 0 + W 81 · (0) = 0 = X 1 x 2 = − 3 x 2 + x 6 = − 6 10 + W 84 · (−6) = 16 16 + W 82 · (0) = 16 = X 2 x 6 = − 3 x 2 − x 6 = 0 0 + W 86 · (0) = 0 0 + W 83 · (0) = 0 = X 3 x 1 = − 1 x 1 + x 5 = − 2 −2 + W 80 · (−2) = − 4 4 + W 84 · (−4) = 8 = X 4 x 5 = − 1 x 1 − x 5 = 0 0 + W 82 · 0 = 0 0 + W 85 · (0) = 0 = X 5 x 3 = − 1 x 3 + x 7 = − 2 −2 + W 84 · (−2) = 0 16 + W 86 · (0) = 16 = X 6 x 7 = − 1 x 3 − x 7 = 0 0 + W 86 · (0) = 0 0 + W 87 · (0) = 0 = X 7

The same answers are obtained using the Matlab command: fft([5 -1 -3 -1 5 -1 -3 -1]). Assuming the samples are of x(n) = 4 cos(πn/2) + cos(πn) we would expect to see 4 peaks ( for each cosine term) with amplitude ratios of 4:1. However, we see only 3 peaks and they have a ration of 2:1. Indices 2 and 6 correspond to the low frequency cosine, while index 4 correspond to the high frequency cosine. Since the sampling frequency is 1 and the frequencies of the cosines are 1 /4 and 1/2, aliasing is present. Notice that the values for the 4 cos(πn/2) components are correct, but the value for the aliased cos(πn) is incorrect. No leakage is present because both components have an integral number of periods in the data record.

Problem 4: (Proakis & Manolakis – Prob. 7.1) Since x(n) is real, the real part of the DFT is even, imaginary part odd ( x(t) real ⇒ X(−jΩ) = X¯(jΩ) ). Thus, the remaining points are { 0 .125 + j 0. 0518 , 0 , 0 .125 + j 0. 3018 }.

Problem 5: (Proakis & Manolakis – Prob. 7.3) Xˆ^ (k) may be viewed as the product of X(k) with:

1 , 0 ≤ k ≤ kc, N − kc ≤ k ≤ N − 1. Fˆ(k) = 0 , kc < k < N − k.

F (k) represents an ideal low-pass filter removing frequency components from (kc + 1) (^) N^2 to π (for a zero-centered set of DFT values). Hence ˆx(n) is a low-pass version of x(n).

Problem 6:

Given the noisy signal created using the following Matlab commands:

t=[0:.01:10.23]; % 1024 Points f=exp(-t).sin(10t); % Clean signal noise=rand(1,1024)-0.5; signal=f+noise; % Additive random noise

Please note that we have changed the noise, such that its average value is equal to zero. Otherwise, we can subtract the DC value manually from DFT component. The DC magnitude is equal to N n 0 where N is the number of points and n 0 is the average value of Noise. Plots of the clean and noisy signals are:

signal + noise

signal

1

0

−0.

− 0 1 2 3 4 5 6 7 8 9 10 time (sec)

2

1

0 −0. 0 1 2 3 4 5 6 7 8 9 10 time (sec)

The DFT magnitude plots are

50

DFT Magnitude |F

|m 40

30 20 10 0

Signal

0 100 200 300 400 500 600 700 800 900 1000 m

0

10

20

30

40

50

DFT Magnitude |F

|m Signal + noise

0 100 200 300 400 500 600 700 800 900 1000 m

The following is the MATLAM script that was used to do crude FFT-based low-pass filtering on the data. The FFT of the data set is computed and K terms Fm, |m| = 0,... , K are retained before takin the IFFT and plotting the result.

(b) K = 60 :

K=

−0.5 (^) Original signal Filtered s+n − 0 1 2 3 4 5 6 7 8 9 time (sec)

(c) K = 40 :

signal

Truncated DFT Magnitude |F |

signal

Truncated DFT Magnitude |F |

m^

m 60

40

20

0 0 100 200 300 400 500 600 700 800 900 1000 m

1 K=

0

−0.5 Original signal Filtered s+n −1 0 1 2 3 4 5 6 7 8 9 time (sec)

60 K= 40

20

0 0 100 200 300 400 500 600 700 800 900 1000 m

1 K=

0

10

10

(d) K = 20 :

0 100 200 300 400 500 600 700 800 900 1000 m

1

0

−0.

− time (sec)

0 1 2 3 4 5 6 7 8 9 10

Original signal Filtered s+n

K=

We can argue about it, but I think that K = 40 looks to be about a good compromise between residual noise and fidelity of the original signal???

signal

|m

0

20

40

60

Truncated DFT Magnitude |F

K=