Digital Signal Processing Reference
In-Depth Information
10
1
noise impulse
0
0.5
−10
0
−20
−0.5
−30
−1
−40
0
0.5
1
1.5
2
2
1 0
k (s)
f (kHz)
(a)
(b)
computed from the amount of attenuation required within the stop band. Using
M ATLAB , the transfer function of the bandpass filter is computed as follows:
Fig. 17.12. Noise-corrupted
signal stored in the
testaudio3.wav file.
(a) Time representation;
(b) power spectrum.
>> wc =[7800 8200]/11025; % Normalized cutoff
% frequency
>> fBs = fir1(128,wc,'stop'); % order-128 filter, 129 tap
>> w = 0:0.001*pi:pi; % discrete frequencies
% for spectrum
>> HBs = freqz(fBs,1,w); % transfer function
>> plot(w*Fs/(2*pi),20*log10 (abs(HBs)));
% magnitude spectrum
The magnitude spectrum of the resulting bandstop filter is plotted in Fig.
17.13(a), which shows strong attenuation at 8 kHz. The gain at the remain-
ing frequencies is close to unity. The noisy signal is filtered with the bandstop
filter and the power spectral density of the filtered signal is calculated using the
following M ATLAB code:
>> xBsf = filter(fBs,1,x); % Bandstop filtered audio
% signal
>> nfft=1024; nwind=1024; noverlap=512;
>> [Pxx, F] = psd (xBsf,nfft,Fs,hanning (nwind),noverlap);
>> plot(F,10*log10(Pxx));
Fig. 17.13. Bandstop filtering to
eliminate noise from the noise
corrupted signal shown in Fig.
17.12. (a) Frequency
characteristics of a 129-tap FIR
bandstop filter, with cut-off
frequencies of [7800 8200] Hz,
designed using a Hamming
windor. (b) Power spectrum of
the filtered signal.
The power spectral density of the filtered output is shown in Fig. 17.13(b),
which shows a strong attenuation in the noise impulse present at 8 kHz. On
playing the filtered signal, we observe that the effects of the noise have been
10
0
0
−10
−10
−20
−20
−30
−30
2
1 0
1 0
f (kHz)
f (kHz)
(a)
(b)
Search WWH ::




Custom Search