Vous êtes sur la page 1sur 13

Design of a linear phase FIR filter

Objective:
FIR, Finite Impulse Response, filters are one of the primary types of filters
used in Digital Signal Processing. FIR filters are said to be finite because
they do not have any feedback. Therefore, if you send an impulse through
the system (a single spike) then the output will invariably become zero as
soon as the impulse runs through the filter. There are four types of filter as
low pass filter (LP), high pass filter (HP), band stop filter (BS) and band pass
filter (BP). Here I have decided to design a high pass filter by using Window
Method (Kaiser Window method, Hamming Window Method and Blackman
Window) and Remez Algorithm Method.

Filter Specification:
A filter transfer function H(w) consists of the magnitude response and the
phase response verses frequency function. To design a FIR high pass filter
there are some specification is needed. The specifications are- sampling
frequency (fS), cutoff frequency (fC), transition width as (f), attenuation (A),
length of FIR filter (N), ideal transfer function H i(n) and the window function
w(n). Here a low pass filter is given as follows

Here,

hi (n)=

sin ( ( n)) sin( C (n ))

(n )
C (n )

[Ideal Transfer Function]

h ( n )=

hi ( n ) (n)

[Transfer

Function

with

Transfer Window]

Methods:
There are four types of methods are available to design a FIR filter. Those are
1.
2.
3.
4.

Window Method
LS Method
Equiripple filter design method
Remez algorithm

There are six types of window in Window method. Those are 1.


2.
3.
4.
5.
6.

Rectangular Window
Triangular Window
Hamming Window
Hanning Window
Kaiser Window
Blackman Window

Here is a brief discussion about the window of the six Window methodsNames of the
Windows
Rectangular

Equation of the window


1, 0 n N 1
0, otherwiseelse

( n)

Triangular

No specified equation

Hamming

2 n

N 1

.54 .46 cos

( n)

Hanning

otherwise
2 n

N 1

.5 .5 cos

( n)

0nN

0n N
otherwise

Kaiser
(n) =

({

2 1
2

( )})

n
I 0 1

0 n N 1
I0 ( )
0 otherwise

Design Parameters:
Kaiser Window Method (Reference - FIR Filter Design Using the Window
Method, Example- 9.5.2)

To design a FIR low pass filter by using the Kaiser Window method I have
used the following parametersfS = 1000
Frequency ]
fC = 250
Frequency ]
f = 50
width ]
= 0.001

[Sampling
[Cut off
[ Transition

To get the attenuation (A), we know


A = -20 log10 ()
To get window function for Kaiser Window, we know

W ( n )=
Here,

({

2 1
2

( )})

n
I 0 1

I0 ( )

.1102( A 8.7);

A 50

.5842( A 21) .4 .07886(a 21); 21 A 50


0.0; A 21

A8

N = 1+ 2.285 w

N 1
2

Results:
fS = 1000
1.0000e-003
A = 60
fC(norm) = 0.2500

fC = 250

f = 50

= 5.6533
f(norm) = 0.0500

= 36.2191
wC = 1.5708

N = 73.4381
w = 0.3142

W(n) = [Values of the Window Function for Kaiser method]


Columns 1 through 11
0.0204
0.0303
0.0420
0.1561 0.1827 0.2114
Columns 12 through 22
0.2422
0.2749
0.3094
0.5424 0.5832 0.6239
Columns 23 through 33
0.6640
0.7032
0.7412
0.9268 0.9479 0.9657
Columns 34 through 44
0.9799
0.9904
0.9971
0.9562 0.9365 0.9134
Columns 45 through 55
0.8874
0.8584
0.8269
0.6011 0.5603 0.5195
Columns 56 through 66
0.4789
0.4389
0.3998
0.1950 0.1675 0.1421

0.0557

0.0715

0.0893

0.1094

0.1316

0.3454

0.3830

0.4217

0.4613

0.5016

0.7777

0.8124

0.8449

0.8750

0.9024

0.9999

0.9988

0.9938

0.9850

0.9724

0.7932

0.7574

0.7200

0.6813

0.6415

0.3617

0.3250

0.2898

0.2563

0.2247

Columns 67 through 73
0.1189 0.0979 0.0790

0.0624

0.0478

0.0352

0.0245

Window Function for kaiser method w(n)

1
0.8

w(n)

0.6
0.4
0.2
0
-0.2
-0.4
0

10

20

30

40

50

60

Figure 1: Kaiser Window function (n)


To get window function for Kaiser Window, we know

W ( n )=

({

2 1
2

( )})

n
I 0 1

I0 ( )

70

Window Function for kaiser method w(n)

0.5

Magnitude response of hi(n)

0.5

Hi(w)

1
0

hi(n)

w(n)

Ideal transfer function hi(n)

0.5

0
0
20

40

-0.5

60

20

(w)))

20

-20

angle((H

20*log10(H

(w))

n
Magnitude response of hi(n) at log scale

-40

20

40
60
n
Phase response of hi(n)

-20

100

200 300 400


Frequency
Magnitude response of h(n)

500

200 300 400 500


Frequency
Magnitude response of h(n) at log scale

20*log10(H(w))

0
100

200 300
Frequency

400

500

500

20

40
60
n
Phase response of h(n)

-50

-100
0

400

-0.5

100

0.5

200 300
Frequency

-40

100

Transfer function h(n)

0.5

-60

-60

H(w)

h(n)

angle(H(w))

-0.5

-50

-100
0

100

200 300
Frequency

400

500

100

200 300
Frequency

400

500

Figure 10: All the output plots for Kaiser window method
Hamming Window Method (Reference Same parameters as Kaiser
Window)

W(n) = [Values of the Window Function for Hamming method]


Columns 1 through 11
0.0800
0.0817
0.0869
0.1864 0.2132 0.2425

0.0955

0.1074

0.1226

0.1409

0.1622

Columns 12 through 22
0.2740
0.3075
0.3427
0.3795
0.4174
0.4563
0.5755 0.6151 0.6541
Columns 23 through 33
0.6923
0.7293
0.7649
0.7989
0.8308
0.8606
0.9347 0.9537 0.9695
Columns 34 through 44
0.9822
0.9915
0.9974
0.9999
0.9989
0.9945
0.9610 0.9434 0.9227
Columns 45 through 55
0.8992
0.8729
0.8442
0.8131
0.7800
0.7451
0.6323 0.5929 0.5531
Columns 56 through 66
0.5132
0.4735
0.4344
0.3960
0.3587
0.3227
0.2257 0.1978 0.1725
Columns 67 through 73
0.1499 0.1302 0.1137 0.1003 0.0902 0.0836 0.0803

0.4958

0.5356

0.8880

0.9127

0.9867

0.9755

0.7087

0.6710

0.2884

0.2560

Plots of the FIR high pass filter by using the given parameters are shown
as followsWindow Function for Hamming method w(n)

1
0.8

w(n)

0.6
0.4
0.2
0
-0.2
-0.4
0

10

20

30

40

50

60

Figure 11: Hamming Window function (n)

70

To get window function for Hamming Window, we know


2 n

N 1

.54 .46 cos

( n)

otherwise

Window Function for Hamming method w(n)

Ideal transfer function hi(n)

0.5

Magnitude response of hi(n)

0.5

Hi(w)

1
0

hi(n)

w(n)

0nN

0.5

0
0
20

40

-0.5

60

20

(w)))

20

-20

angle((H

20*log10(H

(w))

n
Magnitude response of hi(n) at log scale

-40

20

40
60
n
Phase response of hi(n)

-20

100

200 300 400


Frequency
Magnitude response of h(n)

500

200 300 400 500


Frequency
Magnitude response of h(n) at log scale

20*log10(H(w))

0
100

200 300
Frequency

400

500

500

20

40

n
Phase response of h(n)

60

-50

-100
0

400

-0.5

100

0.5

200 300
Frequency

-40

100

Transfer function h(n)

0.5

-60

-60

H(w)

h(n)

angle(H(w))

-0.5

-50

-100
0

100

200 300
Frequency

400

500

100

200 300
Frequency

400

500

Figure 12: All the output plots for Hamming window method

Blackman Window Method (Reference Same parameters as Kaiser


Window)

W(n) = [Values of the Window Function for Blackman method]


Columns 1 through 11
0.0400
0.0022 -0.0722 -0.1045 -0.0543
0.0404
0.1008
0.0299 0.0133 0.0782
Columns 12 through 22
0.1891
0.2673
0.2683
0.2258
0.2178
0.2895
0.4081
0.5035 0.4642 0.4548
Columns 23 through 33
0.5231
0.6388
0.7240
0.7293
0.6827
0.6618
0.7164
0.8932 0.8864 0.8243
Columns 34 through 44
0.7839
0.8176
0.9012
0.9578
0.9339
0.8522
0.7891
0.8619 0.9006 0.8599
Columns 45 through 55
0.7598
0.6761
0.6659
0.7110
0.7363
0.6844
0.5722
0.4520 0.4878 0.5085
Columns 56 through 66
0.4545
0.3401
0.2395
0.2138
0.2506
0.2770
0.2316
0.0320 0.0137 0.0614
Columns 67 through 73
0.1030 0.0752 -0.0138 -0.0922 -0.0956 -0.0305 0.0322

0.0852

0.4951

0.8194

0.7994

0.4751

0.1256

Window Function for Hamming method w(n)

0.8

w(n)

0.6

0.4

0.2

-0.2

-0.4
0

10

20

30

40

50

60

Figure 11: Blackman Window function (n)


To get window function for Blackman Window, we know

2 n
24 n
.08 cos

N 1
N 1

( n)

.42 .46 cos


0

0n N
otherwise

70

Window Function for Hamming method w(n)

0.5

Magnitude response of hi(n)

0.5

Hi(w
)

1
0

hi(n)

w
(n)

Ideal transfer function hi(n)

0.5

0
0
20

40

-0.5

60

20

(w
)))

20

-20

angle((H

20*log10(H

(w
))

n
Magnitude response of hi(n) at log scale

-40

20

40

n
Phase response of hi(n)

60

-20

100

200 300 400


Frequency
Magnitude response of h(n)

500

200 300 400 500


Frequency
Magnitude response of h(n) at log scale

20*log10(H
(w
))

0
100

200 300
Frequency

400

500

500

20

40
60
n
Phase response of h(n)

-50

-100
0

400

-0.5

100

0.5

200 300
Frequency

-40

100

Transfer function h(n)

0.5

-60

-60

H
(w
)

h(n)

angle(H
(w
))

-0.5

-50

-100
0

100

200 300
Frequency

400

500

100

200 300
Frequency

400

500

Figure 12: All the output plots for Blackman window method

Remez algorithm Method


F = [0 0.2 0.4 0.7 0.8 1];
band edges in pairs ]
a = [0.5 0.5 1 1 0.3 0.3];
size as f ]

[ A vector of frequency
[ A real vector the same

Remez Algorithm
0.8
0.7

R eal V ec tor

0.6
0.5
0.4
0.3
0.2
0.1
0
-0.1
-0.2
2

8
10
Frequency

12

14

16

Figure 2: Remez Algorithm

Discussion:
This project paper is summarizes the various equation which is used to
design a FIR high pass filter. Here the high pass filter is designed by using
the Kaiser Window method, hamming window method, Blackman window
method and Remez algorithm method. All the outputs are same for each
method but for Blackman window method there is a slide difference from the
others. By using the equations we can design any kinds of filter in Window
method. By changing the ideal transfer function we can compute the other
filters as High pass (HP) filters, Band stop (BS) filters and Band pass (BP)
filters. At last all the necessary statement has been given as above and other
documents have been attached with the report as follows.

Department of Electrical & Electronics


Engineering
EEE-309, Section-1, Fall-2008

Project

Design a FIR Filter

Submitted To

Kamrul Hassan

Submitted By

Imran Ahmed
ID: 2006-2-80-052

Date of Submission:

02.12.2008

Vous aimerez peut-être aussi