CHAPTER 10 Fourier Analysis of Discrete-Time Signals and Systems
10.4.4 Linear and Circular Convolution Sums
The most important property of the DFT is the convolution property, which permits the computation of the linear convolution sum very efficiently by means of the FFT.
Consider the convolution sum that gives the outputy[n] of a discrete-time LTI system with impulse responseh[n] and inputx[n]:
y[n]=X
m
x[m]h[n−m]
In frequency,y[n] is the inverse DTFT of the product
Y(ejω)=X(ejω)H(ejω)
Assuming thatx[n] has a finite lengthMand that h[n] has a finite lengthK, theny[n] has a finite lengthN=M+K−1. If we choose a periodL≥Nfor the periodic extensiony[n] of˜ y[n], we would obtain the frequency-sampled periodic sequence
Y(ejω)|ω=2πk/L=X(ejω)H(ejω)|ω=2πk/L
or the DFT ofy[n] as the product of the DFTs ofx[n] andh[n]:
Y[k]=X[k]H[k] for k=0, 1,. . .,L−1
We then obtainy[n] as the inverse DFT ofY[k]. It should be noticed that theL-length DFT ofx[n] and ofh[n] requires that we padx[n] withL−Mzeros andh[n] withL−K zeros, so that bothX[k] and H[k] have the same lengthLand can be multiplied at eachk.
10.4 Discrete Fourier Transform 623
FIGURE 10.15 Computation of the FFT of a periodic signal using (a) 4 and (b) 12 periods to improve the frequency resolution of the FFT. Notice that both magnitude and phase
responses look alike, but when we use 12 periods these spectra look sharper due to the increase in the number of frequency
components added.
−0600−400−200 0 200 400 600 5
10 15 20 25
f(Hz)
|X(f)|
−600−400 −200 0 200 400 600
−4
−2 0 2 4
f(Hz)
<X(f)
0 5 10 15 20 25
|X(f)|
−600−400−200 0 200 400 600 f(Hz)
−600−400−200 0 200 400 600 f(Hz)
−4
−2 0 2 4
<X(f)
0 0.02 0.04 0.06 0.08 0.1 0.12
−6
−4
−2 0 2 4
x(nTs)
nTs
0 0.005 0.01 0.015 0.02 0.025 0.03 0.035 0.04
−6
−4
−2 0 2 4
x(nTs)
nTs
(a)
(b)
Givenx[n]andh[n]of lengthsMandK, the linear convolution sumy[n]of lengthN=M+K−1can be found by following these three steps:
n Compute DFTsX[k]andH[k]of lengthL≥Nforx[n]andh[n].
n Multiply them to getY[k]=X[k]H[k].
n Find the inverse DFT ofY[k]of lengthLto obtainy[n].
Although it seems computationally more expensive than performing the direct computation of the convolution sum, the above approach implemented with the FFT can be shown to be much more efficient.
The above procedure could be implemented by a circular convolution sum in the time domain, although in practice it is not done due to the efficiency of the implementation with FFTs. A circu- lar convolution uses circular rather than linear representation of the signals being convolved. The periodic convolution sumintroduced before is a circular convolution of fixed length—the period of the signals being convolved. When we use the DFT to compute the response of an LTI system the length of the circular convolution is given by the possible length of the linear convolution sum. Thus, if the system input is a finite sequencex[n] of lengthMand the impulse response of the systemh[n] has a lengthK, then the output y[n] is given by a linear convolution of lengthM+K−1. The length L≥M+K−1 of the DFTY[k]=X[k]H[k] corresponds to a circular convolution of lengthLof the x[n] andh[n] padded with zeros so that both have lengthL. In such a case the circular and the linear convolutions coincide.
Ifx[n]of lengthMis the input of an LTI system with impulse responseh[n]of lengthK, then
Y[k]=X[k]H[k]⇔y[n]=(x⊗Lh)[n] (10.55)
whereX[k],H[k], andY[k]are, respectively, DFTs of lengthLof the input, the impulse response, and the output of the LTI system, and⊗Lstands for the circular convolution of lengthL.
IfLis chosen so thatL≥M+K−1, the circular and the linear convolution sums coincide—that is,
y[n]=(x⊗Lh)[n]=(x∗h)[n] (10.56) Remark If we consider the periodic expansions of x[n]and h[n]with period L=M+K−1, we can use their circular representations and implement the circular convolution as shown in Figure 10.16. Since the length of the linear convolution or convolution sum, M+K−1, coincides with the length of the circular convolution, the two convolutions coincide. Given the efficiency of the FFT algorithm in computing the DFT, the convolution is typically done using the DFT as indicated above.
nExample 10.22
To illustrate the connection between the circular and the linear convolution, compute using MAT- LAB the circular convolution of a pulse signalx[n]=u[n]−u[n−21] of lengthN=20 with itself for different values of its length. Determine the length for which the circular convolution coincides with the linear convolution ofx[n] with itself.
10.4 Discrete Fourier Transform 625
FIGURE 10.16
Circular convolution of lengthL=8ofx[n]
andy[n]. The signalx[k]is stationary with a circular representation given by the inside circle, whiley[n−k]is represented by the outside circle and rotated in the clockwise direction. The shown circular convolution sum corresponds ton=0.
y[3]
y[2]
y[1]
y[0]
y[7]
y[6]
y[5]
y[4]
x[3] x[2]
x[1]
x[0]
x[7]
x[6]
x[5]
x[4]
n=0
FIGURE 10.17 Circular versus linear convolutions: (a) Plot corresponds to linear convolution. (b) and (c) Plots are circular convolutions wih L<2N−1. (d) Plot is circular convolution with L>2N−1coinciding with the linear convolution.
0 10 20 30 40
0 5 10 15 20
z(n)
Linear convolution
0 10 20 30 40
0 5 10 15 20
y(n)
Circular convolution (L=20)
0 10 20 30 40
0 5 10 15 20
n
Circular convolution (L=49)
y2(n)
0 10 20 30 40
0 5 10 15 20
n
Circular convolution (L=30)
y1(n)
(a) (b)
(c) (d)
Solution
We know that the length of the linear convolutionz[n]=(x∗x)[n] isN+N−1=39. If we use the function circonv2shown below to compute the circular convolution ofx[n] with itself with lengthN<2N−1, for instanceL=20 as shown in Figure 10.17(b), the result will not equal the linear convolution. Likewise, if the circular convolution is of lengthN+10=30<2N−1, only part of the result resembles the linear convolution (see Figure 10.17(c)). If we let the length of the circular convolution be 2N+9=49>2N−1, the result is identical to the linear convolution (see Figure 10.17(d)). The script is given as follows.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Example 10.22---Linear and circular convolution
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear all; clf
N = 20; x = ones(1,N);
% linear convolution
z = conv(x,x);z = [z zeros(1,10)];
% circular convolution y = circonv2(x,x,N);
y1 = circonv2(x,x,N + 10);
y2 = circonv2(x,x,2∗N + 9);
Mz = length(z); My = length(y); My1 = length(y1);My2 = length(y2);
y = [y zeros(1,Mz - My)]; y1 = [y1 zeros(1,Mz - My1)]; y2 = [y2 zeros(1,Mz-My2)];
The functioncirconv2has as inputs the signals to be convolved and the desired length of the circular convolution. It computes and multiplies the FFTs of the signals and then finds the inverse FFT to obtain the circular convolution. If the desired length of the circular convolution is larger than the length of each of the signals, the signals are padded with zeros to make them the length of the circular convolution. The following is the code for this function.
function xy = circonv2(x,y,N) M = max(length(x),length(y)) if M>N
disp(‘Increase N’) end
x = [x zeros(1,N - M)];
y = [y zeros(1,N - M)];
% circular convolution
X = fft(x,N); Y = fft(y,N); XY = X.∗Y;
xy = real(ifft(XY,N));
n nExample 10.23
A significant advantage of using the FFT for computing the DFT is in filtering. Assume that the signal to filter consists of the MATLAB file “laughter.mat,” multiplied by 5, to which a sig- nal that continuously changes between−0.3 and 0.3 is added. We wish to recover the original
“laughter.mat” signal using a filter. Use the MATLAB functionfir1to design the required filter.
Solution
Noticing that since the disturbance 0.3(−1)n is a signal of frequencyπ, we need a low-pass filter with a wide bandwidth so as to get rid of the disturbance while trying to keep the frequency components of the desired signal. The following script is used to design the desired low-pass filter, and to implement the filtering. To compare the results obtained with the FFT we use the function convto find the output of the filter in the time domain. The results are shown in Figure 10.18.
10.4 Discrete Fourier Transform 627
FIGURE 10.18 FIR filtering of disturbed signal. Comparison of results usingconvandfft
functions. (a) Actual and noisy signal (plotted as a continuous signal using black lines); (b) denoised signal (notice the delay caused by the FIR filter); (c) impulse response and magnitude response of low-pass FIR filter; and (d) error signal [n]=y[n]−y1[n]between output fromconv- and fft-based filtering.
0 10 20 30 40
−0.2 0 0.2 0.4 0.6 0.8 1
n
h[n]
0 20 40 60 80 100 120 140
−1
−0.5 0 0.5 1
n
y[n]
0 20 40 60 80 100 120 140
−2 0 2 4
n
×10−16
ε[n]
0 10 20 30 40 50 60 70 80 90 100
−1
−0.5 0 0.5 1
n x[n], x1[n]
0 1 2 3
0 0.2 0.4 0.6 0.8 1
ω
|H(ejω)|
(a)
(c) (b)
(d)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Example 10.23---Filtering using convolution and FFT
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear all; clf
N = 100; n = 0:N - 1;
load laughter
x = 5∗y(1:N)’; x1 = x + 0.3∗(-1).ˆn; % desired signal plus disturbance h = fir1(40,0.9); [H,w] = freqz(h,1); % low-pass FIR filter design
% filtering using convolution
y = conv(x,h); % convolution of signal and impulse response of FIR
% computing using FFT
M = length(x) + length(h) - 1; % circular and linear convolutions equal X = fft(x,M);
H = fft(h,M);
Y = X.∗H;
y1 = ifft(Y); % output of filtering n