10.2 Discrete-Time Fourier Transform 585
FIGURE 10.3
Top: Downsampler and decimator. Bottom:
upsampler and interpolator.
H(z)
H(z)
LPF
Downsampler Decimator
Upsampler
̃
LPF
Interpolator
x[n] x[n]
x[n]
x 1 [n] x 1 [Mn]
x[n]
x[Mn]
x[n] x[n/L] x[n/L]
MM↓↓ M↓
L↑ L↑
%%%%%%%%%%%%%%%%%%%%%%%%%
% Example 10.6---down--sampling and decimation
%%%%%%%%%%%%%%%%%%%%%%%%%
x = [ones(1,10) zeros(1,100)];Nx = length(x); n1 = 0:19; % first signal
% Nx = 200;n = 0:Nx - 1; x = cos(pi∗n/4); % second signal
y = x(1:2:Nx - 1); % downsampling with M = 2
X = fft(x);Y = fft(y); % ffts of original and downsampled signals
L = length(X);w = 0:2∗pi/L:2∗pi - 2∗pi/L;w1 = (w - pi)/pi; % frequency range
z = decimate(x,2,‘fir’); % decimation with M = 2
Z = fft(z); % fft of decimated signal
%%%%%%%%%%%%%%%%%%%%%%%%%
% interpolation
%%%%%%%%%%%%%%%%%%%%%%%%%
s = interp(y,2);
As shown in Figure 10.4, the rectangular pulse is not band limited toπ/2 since it has frequency
components beyondπ/2, while the sinusoid is band limited. The DTFT of the downsampled rect-
angular pulse (a narrower pulse) is not an expanded version of the DTFT of the pulse, while the
DTFT of the downsampled sinusoid is an expanded version. The MATLAB functiondecimateuses
an FIR low-pass filter to smooth outx[n] to a frequency ofπ/2 before downsampling. In the case of
the sinusoid, which satisfies the downsampling condition, the downsampling and the decimation
provide the same results, but not for the rectangular pulse.
The original discrete-time signal can be recovered by interpolation. This procedure is composed
of upsampling followed by low-pass filtering. The MATLAB functioninterpis used to that effect.
If we use the downsampled signal as input to this function, we obtain slightly better results for
the sinusoid than for the pulse when comparing the interpolated signal to the original signal.
The results are shown in Figure 10.5. The errors[n]−x[n] is shown also. The signals[n] is the
interpolation of the downsampled signaly[n]. n
10.2.5 Parseval’s Energy Result...........................................................
Just like in the case of continuous-time signals, the energy or power of a discrete-time signalx[n] can
be equally computed in either the time or the frequency domain.