Digital Signal Processing Reference
In-Depth Information
2
1.5
1
0.5
0
0
2000
4000
6000
8000
10000
12000
Frequency (Hz)
2
1.5
1
0.5
0
0
2000
4000
6000
8000
10000
12000
Frequency (Hz)
FIGURE 12.9A
(Top) Spectrum after upsampling, and (bottom) spectrum after interpolation filtering.
The sequence from step 1 can be filtered via another FIR lowpass filter with filter length N ¼ 159 and
a cutoff frequency of 1,250 Hz, followed by downsampling by a factor of M ¼ 8. The spectrum after
the anti-aliasing filter and the spectrum for the final output yðmÞ are plotted in Figure 12.9B . Note that
the anti-aliasing filter removes the frequency component of 2.5 kHz to avoid aliasing. This is because
after downsampling, the Nyquist limit is 1.5 kHz. As we discussed previously, we can select one filter
for implementation. We choose a FIR lowpass filter with N ¼ 159 and a cutoff frequency of 1,250 Hz
because its bandwidth is smaller than that of the interpolation filter. The MATLAB implementation is
listed in Program 12.3.
Program 12.3 MATLAB program for changing sampling rate with a noninteger factor.
close all; clear all;clc;
% Downsampling filter
Bdown ¼ firwd(159,1,2*pi*1250/24000,0,4);
% Generate 2048 samples with fs ¼ 8000 Hz
fs ¼ 8000;
% Original sampling rate
N ¼ 2048;
% The number of samples
L
¼
3;
% Upsampling factor
M
¼
8;
% Downsampling factor
n
¼
0:1:N-1;
% Generate the time index
x
¼
5*sin(n*pi/4)
þ
cos(5*n*pi/8);
% Generate the test signal
% Upsampling by a factor of L
w1 ¼ zeros(1,L*N);
 
Search WWH ::




Custom Search