Professional Documents
Culture Documents
EE408 Digital Signal Processing OL12
EE408 Digital Signal Processing OL12
1 , n = 0,1,..., ( M − 1) / 2
w(n) =
0 , elsewhere
The resulting impulse response decays
smoothly towards zero as shown below.
− ( M − 2) / 2 ≤ n ≤ ( M − 1) / 2 ( M .odd )
0.54 + 0.46 cos(2πn / M )
w(n) = −M /2 ≤ n ≤ M /2 ( M .even)
0 elsewhere
b) Hanning Window
The Hanning window is defined as
− ( M − 2) / 2 ≤ n ≤ ( M − 1) / 2 ( M .odd )
0.5 + 0.5 cos(2πn / M )
w(n) = −M /2≤ n ≤ M /2 ( M .even)
0 elsewhere
c) Blackman Window
The Blackman window is defined as
2πn 4πn − ( M − 2) / 2 ≤ n ≤ ( M − 1) / 2 ( M .odd )
0.42 + 0.5 cos + 0.08 cos
w(n) = M −1 M − 1 −M /2 ≤ n ≤ M /2 ( M .even)
0 elsewhere
2 × 0.21875
n=1 hD (1) = sin(2π × 0.21875) = 0.31219
2π × 0.21875
2π
w(1) = 0.54 + 0.46 cos( ) = 0.99677
53
h(1) = h(−1) = hD (1) w(1) = 0.31118
2 × 0.21875
n=2 hD (2) = sin( 2 × 2π × 0.21875) = 0.06013
2 × 2π × 0.21875
2 × 2π
w(2) = 0.54 + 0.46 cos( ) = 0.98713
53
h(2) = h(−2) = hD (2) w(2) = 0.06012
. . .
. . .
. . .
n=26
2 × 0.21875
hD (26) = sin( 26 × 2π × 0.21875) = −0.01131
26 × 2π × 0.21875
26 × 2π
w(2) = 0.54 + 0.46 cos( ) = 0.08081
53
h(26) = h(−26) = hD (26) w(26) = −0.000914
δ = min(δ p , δ s ) = 0.001
It is clear from Table 6.2 that the attenuation
requirements can be met by the Kaiser or the
Blackman window.
MATLAB m-file:
FS=10000; %Sampling Fre.
fc=0.53; %Cutoff frequency
M=10; %Filter length
hd=fir1(M-1,fc,boxcar(M)); %Ideal
wn=hamming(M); %Calculate coefficients
hn=fir1(M-1,fc,wn); %Obtain win. coeff.
[H,f]=freqz(hn,1,512,FS);%Fre. Res.
mag=20*log10(abs(H));
plot(f,mag), grid on
xlabel (‘Frequency (Hz)’)
ylabel (‘MagnitudeResponse(dB)’)
-10
-20
Magnitude Response (dB)
-30
-40
-50
-60
-70
-80
-90
0 500 1000 1500 2000 2500 3000 3500 4000 4500 5000
Frequency(Hz)
Transition width=50Hz
Passband ripple=0.1dB
Stopband attenuation=60dB
Sampling frequency=1kHz
MATLAB m-file:
FS=1000;
FN=FS/2;
M=73;
beta=5.65;
fc1=125/FN;
fc2=275/FN;
FC=[fc1 fc2];
hn=fir1(M-1,FC,kaiser(M,beta));
[H,f]=freqz(hn,1,512,FS);
mag=20*log10(abs(H));
plot(f,mag), grid on
xlabel (‘Frequency (Hz)’)
ylabel (‘MagnitudeResponse(dB)’)
-20
Magnitude Response (dB)
-40
-60
-80
-100
-120
0 50 100 150 200 250 300 350 400 450 500
Frequency(Hz)