Digital Signal Processing Reference
In-Depth Information
for n ¼ 0:1:N-1
w1(L*n þ 1) ¼ x(n þ 1);
end
NL ¼ length(w1); % Length of upsampled data
W1 ¼ 2*abs(fft(w1,NL))/NL;W1(1) ¼ W1(1)/2; % Compute the one-sided
% amplitude spectrum
f ¼ [0:1:NL/2-1]*fs*L/NL; % Map frequency index to its frequency in Hz
subplot(3,1,1);plot(f,W1(1:1:NL/2));grid
xlabel(
Frequency (Hz)
);
'
'
w2
¼
filter(Bdown,1,w1);
% Perform the combined anti-aliasing filter
W2
¼
2*abs(fft(w2,NL))/NL;W2(1)
W2(1)/2; % Compute the one-sided
% amplitude spectrum
¼
y2
w2(1:M:NL);
NM ¼ length(y2); % Length of the downsampled data
Y2 ¼ 2*abs(fft(y2,NM))/NM;Y2(1) ¼ Y2(1)/2;% Compute the one-sided
%amplitude spectrum
% Map frequency index to its frequency in Hz before downsampling
fbar ¼ [0:1:NL/2-1]*24000/NL;
% Map frequency index to its frequency in Hz
fsM ¼ [0:1:NM/2-1]*(fs*L/M)/NM;
subplot(3,1,2);plot(f,W2(1:1:NL/2));grid; xlabel( ' Frequency (Hz) ' );
subplot(3,1,3);plot(fsM,Y2(1:1:NM/2));grid; xlabel( ' Frequency (Hz) ' );
¼
2
1.5
1
0.5
0
0
2000
4000
6000
8000
10000
12000
Frequency (Hz)
2
1.5
1
0.5
0
0
500
1000
1500
Frequency (Hz)
FIGURE 12.9B
(Top) Spectrum after anti-aliasing filtering, and (bottom) spectrum after downsampling.
 
Search WWH ::




Custom Search