Biomedical Engineering Reference
In-Depth Information
are beyond the scope of this text and can be found in many signal processing textbooks.
However, numerous window functions have been developed for a variety of applications.
Some of the most celebrated window functions include the Kaiser, Hanning, and Hamming
windows.
So far, we have illustrated the windowing method for a continuous filter, but we would
like to apply this procedure to develop a discrete FIR filter. To achieve this, the continuous
filter impulse response is sampled by allowing
t ¼ k = F s
, for integer
k
. The resulting discrete
impulse response is expressed as
w ðÞ¼ W p s
h ½¼ W p s
inc W c
F s k
inc
O c ð w ðÞ
ð
11
:
48
Þ
where
is the digital cutoff frequency of the filter. Note that according to the
Nyquist sampling theorem, 0
O c ¼ W c = F s
< W c < F s =
2, and thus 0
< O c <
p.
EXAMPLE PROBLEM 11.25
In MATLAB, implement a 201 sample digital low-pass and high-pass filter using a Hanning
window. The cutoff frequency of both filters is 1000 Hz. Plot the impulse response and transfer
function magnitude.
Solution
Wc
¼
2*pi*1000; %Cutoff Frequency in Radians / Sec
¼
Fs
10000; %Sampling Rate in Hz
¼
T
1/Fs;
%Ideal Filters
N
¼
100; %Filter Order
t
(-N:N)/Fs; %Time Axis Sampled at Fs
h_lp
¼
Wc/pi*sinc(1/pi*Wc*t); %Sampled Ideal Low-pass Filter
Impulse Response
delta
¼
[zeros(1,N) Fs zeros(1,N)]; %Discrete Diract Impulse
Function
h_hp
¼
¼
(delta-h_lp); %Sampled Ideal High-pass Filter Impulse
Response
%Hanning Filters
W
¼
þ
hanning(2*N
1)'; %Hanning Window
¼
h_lp
h_lp.*W; %Hanning Low-pass Filter Impulse Response
¼
h_hp
h_hp.*W; %Hanning High-pass Filter Impulse Response
¼
NFFT
1024*8; %FFT number of samples
¼
faxis
(0:NFFT-1)/NFFT*Fs; %Frequency Axis
¼
H_lp
abs(fft(h_lp,NFFT))/Fs; %Hanning Low-pass Filter Transfer
Function Magnitude
H_hp
¼
abs(fft(h_hp,NFFT))/Fs; %Hanning High-pass Filter Transfer
Function Magnitude
Search WWH ::




Custom Search