asst. prof. dr. peerapol yuvapoositanon , phd,dic department of electronic engineering and

53
EEET0770 Digital Filter Design Centre of Electronic Systems and Digital Signal Processing กกกกกกกกกกกกกกกกกกกกกกก Digital Filters Design Chapter 4 Finite Impulse Response Filter Design Asst. Prof. Dr. Peerapol Yuvapoositanon, PhD,DIC Department of Electronic Engineering and Graduate School of Electrical Engineering Mahanakorn University of Technology 1

Upload: lucian-rodgers

Post on 03-Jan-2016

29 views

Category:

Documents


0 download

DESCRIPTION

การออกแบบตัวกรองดิจิตอล Digital Filters Design Chapter 4 Finite Impulse Response Filter Design. Asst. Prof. Dr. Peerapol Yuvapoositanon , PhD,DIC Department of Electronic Engineering and Graduate School of Electrical Engineering Mahanakorn University of Technology. ข้อดีของ FIR. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Asst. Prof. Dr.  Peerapol Yuvapoositanon ,  PhD,DIC Department of Electronic Engineering  and

EEET0770 Digital Filter Design

Centre of Electronic Systems and Digital Signal Processing

การออกแบบตั�วกรองดิ�จิ�ตัอลDigital Filters Design

Chapter 4 Finite Impulse Response

Filter Design

Asst. Prof. Dr. Peerapol Yuvapoositanon, PhD,DICDepartment of Electronic Engineering

and Graduate School of Electrical Engineering Mahanakorn University of Technology

1

Page 2: Asst. Prof. Dr.  Peerapol Yuvapoositanon ,  PhD,DIC Department of Electronic Engineering  and

EEET0770 Digital Filter Design

Centre of Electronic Systems and Digital Signal Processing

EEET0770 Digital Filter Design

ข้�อดิ�ข้อง FIR

• มี�ความีเสถี�ยร (stable)• สามีารถีออกแบบให้�ผลตอบสนองทางเฟส เป็�น

เชิ�งเส�น (Linear phase) ได้�ง�าย

2

Page 3: Asst. Prof. Dr.  Peerapol Yuvapoositanon ,  PhD,DIC Department of Electronic Engineering  and

EEET0770 Digital Filter Design

Centre of Electronic Systems and Digital Signal Processing

EEET0770 Digital Filter Design

เฟสที่��เป็�นเชิ�งเส�น (linear phase)

( ) ( )j jH e A e

( )jH e

j ne j j nAe e

( )jH e

a เฟสค อ

ต!วกรอง FIR ท�#ให้� เฟสเป็�นเชิ�งเส�น จะมี�เง #อนไขของการสมีมีาตร

a=ค�าคงท�#

3

Page 4: Asst. Prof. Dr.  Peerapol Yuvapoositanon ,  PhD,DIC Department of Electronic Engineering  and

EEET0770 Digital Filter Design

Centre of Electronic Systems and Digital Signal Processing

EEET0770 Digital Filter Design

เง��อนไข้ข้องตั�วกรองเฟสเชิ�งเส�น

สมมาตัร (symmetric)

สมมาตัรตัรงก�นข้�าม (Anti-symmetric)

N เลขค�#

N เลขค�#

N เลขค'�

N เลขค'�

1 2 3 4 50

•ด้'จากผลตอบสนองอ�มีพั!ลส) h(n) ( )h n

n1 2 3 40

1 2 3 40

1 2 3 4 50

( )h n

n( )h n

n( )h n

n

4

Page 5: Asst. Prof. Dr.  Peerapol Yuvapoositanon ,  PhD,DIC Department of Electronic Engineering  and

EEET0770 Digital Filter Design

Centre of Electronic Systems and Digital Signal Processing

EEET0770 Digital Filter Designพิ�จิารณากรณ�h(n) “ ” เป็�น สมมาตัร และ N เป็�น

เลข้คี่��

1

0

( ) ( )

( ) ( ) 2 ( ) cos( ( ))

j j jM

Mj

n

H e H e e

H e h M h n M n

( ) ( 1 )h n h N n กรณี� ท�# n=0,…,N-1

ขนาด้เฟส

*ตั#อไป็น�$ เราจิะใชิ� h(n) แบบ สมมาตัร“ ,N เลข้คี่�� ส&าหร�บตั�วกรอง ” FIR

โด้ยท�#

M

1

2

NM

เมี #อให้�

เราจะได้�ว�า

5

Page 6: Asst. Prof. Dr.  Peerapol Yuvapoositanon ,  PhD,DIC Department of Electronic Engineering  and

EEET0770 Digital Filter Design

Centre of Electronic Systems and Digital Signal Processing

EEET0770 Digital Filter Design

FIR Filter Design

• เน #องจาก FIR ท�#เราพั�จารณีาน!,นให้�ผลตอบสนอง ทางเฟสเป็�นเชิ�งเส�น (Linear phase) ด้!งน!,น

การออกแบบจ-งกระท.าโด้ยใชิ� การพั�จารณีาทาง ขนาด้ (Magnitude) เท�าน!,น

• มี�การออกแบบ 2 ว�ธี�ท�#น�ยมีค อ– การออกแบบโด้ยใชิ�ห้น�าต�าง (Window Method)– การออกแบบ FIR โด้ยเทคน�กส0�มีความีถี�#

(Frequency Sampling Method)

6

Page 7: Asst. Prof. Dr.  Peerapol Yuvapoositanon ,  PhD,DIC Department of Electronic Engineering  and

EEET0770 Digital Filter Design

Centre of Electronic Systems and Digital Signal Processing

EEET0770 Digital Filter Design

0 c c

1 1

0

1 1

11 2

2

Low pass filter (LPF ) High pass filter (HPF)

Band pass filter (BPF) Band stop filter (BSF)

( )jD e ( )jD e

0 c c

0 1 22 1

7

( )jD e ( )jD e

Page 8: Asst. Prof. Dr.  Peerapol Yuvapoositanon ,  PhD,DIC Department of Electronic Engineering  and

EEET0770 Digital Filter Design

Centre of Electronic Systems and Digital Signal Processing

EEET0770 Digital Filter Design

ผลตัอบสนองอ�มพิ�ลส)ข้องตั�วกรองตั&�า ผ#าน LPF

( ) IDTFT ( )

1( )

2

1 1(1).

2 2

sin( )

c c c

c

j

j j n

j n j nj n

c

d n D e

D e e d

e ee d

jn

n

n

8

Page 9: Asst. Prof. Dr.  Peerapol Yuvapoositanon ,  PhD,DIC Department of Electronic Engineering  and

EEET0770 Digital Filter Design

Centre of Electronic Systems and Digital Signal Processing

EEET0770 Digital Filter Design

ผลตัอบสนองอ�มพิ�ลส)ตั�วกรองอ*ดิมคี่ตั�

เราพับว�า ไม#สามารถสร�าง d(n) ได้� เพัราะเป็�น d(n)noncausal ( เวลาเป็�นคี่#า

ลบ)

เราจิ,งตั�องใชิ�การป็ระมาณคี่#า (approximation)

9

Page 10: Asst. Prof. Dr.  Peerapol Yuvapoositanon ,  PhD,DIC Department of Electronic Engineering  and

EEET0770 Digital Filter Design

Centre of Electronic Systems and Digital Signal Processing

EEET0770 Digital Filter Design

ตั�วกรองตั&�าผ#านที่��ตั�องการ

,( )

0,

jMcj

c

eD e

1

0c

( )jD e

c=ความีถี�#ต!ด้ (Cut-off frequency)

( ) 1jD e

10

Page 11: Asst. Prof. Dr.  Peerapol Yuvapoositanon ,  PhD,DIC Department of Electronic Engineering  and

EEET0770 Digital Filter Design

Centre of Electronic Systems and Digital Signal Processing

EEET0770 Digital Filter Designผลตอบสนองอ�มีพั!ลส)ของต!วกรองต.#าผ�าน

ท�#มี�การ เล #อน M ล.าด้!บ

( ) ( )

( ) IDTFT ( )

1( )

2

1 11. .

2 2 ( )

sin( ( ))

( )

c c c

c

j

j j n

j n M j n Mj M j n

c

d n M D e

D e e d

e ee e d

j n M

n M

n M

11

Page 12: Asst. Prof. Dr.  Peerapol Yuvapoositanon ,  PhD,DIC Department of Electronic Engineering  and

EEET0770 Digital Filter Design

Centre of Electronic Systems and Digital Signal Processing

EEET0770 Digital Filter Design การออกแบบตั�วกรอง FIR โดิยใชิ� ฟ/งก)ชิ�น หน�าตั#าง

(Windowing Techniques) • ข!,นตอนการออกแบบ• 1. เล #อนล.าด้!บ d(n) ไป็ทางขวา M ล.าด้!บ • 2. ต!ด้ล.าด้!บของ d(n) ท�#เป็�นแบบไมี�

จ.าก!ด้( infinite) ให้�เป็�นแบบ จ.าก!ด้ (finite) โด้ยใชิ�การค'ณีด้�วย ห้น�าต�าง (window)

12

Page 13: Asst. Prof. Dr.  Peerapol Yuvapoositanon ,  PhD,DIC Department of Electronic Engineering  and

EEET0770 Digital Filter Design

Centre of Electronic Systems and Digital Signal Processing

EEET0770 Digital Filter Design

การออกแบบดิ�วยหน�าตั#าง

´0

=

( )w n( )d n M ( )h n

1N -

( ) ( ) ( )h n d n M w n 1, 0 1

( )0,

n Nw n

otherwise

โด้ยท�#ฟ1งก)ชิ!นห้น�าต�าง w(n) เป็�น

เราได้�สมีการของ h(n)

M M1N -

0 0

N = อ!นด้!บ (order) ของต!วกรองM=(N-1)/2

n nn

13

Page 14: Asst. Prof. Dr.  Peerapol Yuvapoositanon ,  PhD,DIC Department of Electronic Engineering  and

EEET0770 Digital Filter Design

Centre of Electronic Systems and Digital Signal Processing

EEET0770 Digital Filter Design

การคี่0ณในโดิเมนเวลา = การป็ระสานในโดิเมนคี่วามถ��

0 pcw

* 0 c( )jW e

( )jD e w

p- cw-

c

( )jH e

การป็ระสาน

14

Page 15: Asst. Prof. Dr.  Peerapol Yuvapoositanon ,  PhD,DIC Department of Electronic Engineering  and

EEET0770 Digital Filter Design

Centre of Electronic Systems and Digital Signal Processing

EEET0770 Digital Filter Design

การป็ระมาณคี่#าส&าหร�บวงจิรกรองตั&�าผ#าน

1

0c

( )jH e

ร�ป็เป็2, ลแถีบผ�าน

ร�ป็เป็2, ล แถีบห้ย0ด้

ส��งที่��ส&าคี่�ญในการออกแบบ วงจิรกรองดิ�จิ�ตัอลคี่�อ1 ร�ป็เป็2$ ล ที่�$งแถบผ#านและแถบหย*ดิ2 คี่วามชิ�นระหว#างแถบ

----- ตั�วกรองอ*ดิมคี่ตั� ตั�วกรองตัามจิร�ง

15

Page 16: Asst. Prof. Dr.  Peerapol Yuvapoositanon ,  PhD,DIC Department of Electronic Engineering  and

EEET0770 Digital Filter Design

Centre of Electronic Systems and Digital Signal Processing

EEET0770 Digital Filter Design

ข้�อก&าหนดิในการออกแบบตั�วกรอง(Filter specification)

1 p

1 p1

s

0p s

( )jH e ( )jD e

c

แถบผ#าน แถบหย*ดิ

แถบเป็ล��ยน

0.5

pA

sA

120log dB

1p

pp

A

20log dBs sA

16

Page 17: Asst. Prof. Dr.  Peerapol Yuvapoositanon ,  PhD,DIC Department of Electronic Engineering  and

EEET0770 Digital Filter Design

Centre of Electronic Systems and Digital Signal Processing

EEET0770 Digital Filter Design

คี่*ณสมบ�ตั�ข้องฟ/งก)ชิ�นหน�าตั#าง

( )jW e

sA

โลบข�าง (sidelobe)

โลบห้ล!ก(Main lobe)

ความีกว�างของแถีบเป็ล�#ยน17

Page 18: Asst. Prof. Dr.  Peerapol Yuvapoositanon ,  PhD,DIC Department of Electronic Engineering  and

EEET0770 Digital Filter Design

Centre of Electronic Systems and Digital Signal Processing

EEET0770 Digital Filter Design

ตัาราง หน�าตั#างหน�าตั#าง As

ส�#เห้ล�#ยมี 8. 9

%

21

1

ฮานน�#ง(Hanning)

0.63%

44

แฮมีมี�#ง(Hamming)

0.2

2%

53

แบล4กแมีน

(Blackman)

0.0

2%

74

p ( )w n

20.5 0.5cos

1

n

N

20.42 0.5cos

1

40.08cos

1

n

N

n

N

4

N

8

N

12

N

8

N

20.54 0.46cos

1

n

N

18

Page 19: Asst. Prof. Dr.  Peerapol Yuvapoositanon ,  PhD,DIC Department of Electronic Engineering  and

EEET0770 Digital Filter Design

Centre of Electronic Systems and Digital Signal Processing

EEET0770 Digital Filter Design

ข้�$นตัอนออกแบบตั�วกรอง FIR โดิยใชิ�หน�าตั#าง

• ใชิ� ค�าร�ป็เป็2, ลของแถีบผ�าน ( ) ห้ร อ การลด้ ทอนของแถีบห้ย0ด้ As เพั #อเล อกชิน�ด้ของ

ห้น�าต�าง ( ข�ามีข!,นตอนน�, ห้ากก.าห้นด้ชิน�ด้ห้น�าต�างมีาให้�)

• ใชิ� ค�าความีกว�างของแถีบเป็ล�#ยน ( ) ห้า“ อ!นด้!บ (order)” ของต!วกรอง (N) ท�#ต�องใชิ�

• เล #อน d(n) ให้�ห้น�วงไป็ M ต.าแห้น�ง และค.านวณี– h(n)=d(n-M)w(n), n=0,…,N-1

• น.า h(n) ท�#ได้� ไป็ เป็�นค�า สป็ส ของ ต!วกรอง

p

19

Page 20: Asst. Prof. Dr.  Peerapol Yuvapoositanon ,  PhD,DIC Department of Electronic Engineering  and

EEET0770 Digital Filter Design

Centre of Electronic Systems and Digital Signal Processing

EEET0770 Digital Filter Design

ตั�วอย#าง 1• จงออกแบบต!วกรอง FIR LPF ท�#มี�ความีถี�#ต!ด้ท�# 500

Hz โด้ยใชิ� ห้น�าต�างส�#เห้ล�#ยมี และ ความีกว�างแถีบเป็ล�#ยน น�อยกว�า 90 Hz ระบบใชิ�ความีถี�#ส0�มี (fs) =2 kHz

0

1

0.5

500cf Hz90 Hzf

f

( )jH e

20

Page 21: Asst. Prof. Dr.  Peerapol Yuvapoositanon ,  PhD,DIC Department of Electronic Engineering  and

EEET0770 Digital Filter Design

Centre of Electronic Systems and Digital Signal Processing

EEET0770 Digital Filter Design

ตั�วอย#าง 1 (ตั#อ)

2 2 500radians

2000 2c

cs

f

f

2 2 (90)0.2827 radians

2000s

f

f

4

N

4 4

44.440.2827

N

เล อกเลขค�#จ.านวนเต4มีท�# มีากกว�า 44.44 น!#นค อ N=45

ความีถี�#ต!ด้ ด้�จ�ตอล

แถีบความีถี�#เป็ล�#ยน ด้�จ�ตอล

จากตารางท�# 7.2

ห้าออเด้อร) ของต!วกรอง

21

Page 22: Asst. Prof. Dr.  Peerapol Yuvapoositanon ,  PhD,DIC Department of Electronic Engineering  and

EEET0770 Digital Filter Design

Centre of Electronic Systems and Digital Signal Processing

EEET0770 Digital Filter Design

ตั�วอย#าง 1 (ตั#อ)

122

2

NM

sin( )

( )( )

cn Md n M

n M

( ) ( ) ( )

sin( ), 0,..., 1

( )

sin( 22)2 , 0,..., 44

( 22)

c

h n d n M w n

n Mn N

n M

nn

n

22

Page 23: Asst. Prof. Dr.  Peerapol Yuvapoositanon ,  PhD,DIC Department of Electronic Engineering  and

EEET0770 Digital Filter Design

Centre of Electronic Systems and Digital Signal Processing

EEET0770 Digital Filter Design

ข้นาดิข้องตั�วกรองตั&�าผ#านที่��ออกแบบไดิ�

ex_7_1.eps500 Hz23

Page 24: Asst. Prof. Dr.  Peerapol Yuvapoositanon ,  PhD,DIC Department of Electronic Engineering  and

EEET0770 Digital Filter Design

Centre of Electronic Systems and Digital Signal Processing

EEET0770 Digital Filter Design

ผลตัอบสนองอ�มพิ�ลส) h(n) ข้องตั�วกรอง

ex_7_2.eps

24

Page 25: Asst. Prof. Dr.  Peerapol Yuvapoositanon ,  PhD,DIC Department of Electronic Engineering  and

EEET0770 Digital Filter Design

Centre of Electronic Systems and Digital Signal Processing

EEET0770 Digital Filter Design

หน�าตั#างส��เหล��ยม

-21 dB

25

Page 26: Asst. Prof. Dr.  Peerapol Yuvapoositanon ,  PhD,DIC Department of Electronic Engineering  and

EEET0770 Digital Filter Design

Centre of Electronic Systems and Digital Signal Processing

EEET0770 Digital Filter Design

หน�าตั#าง ฮานน��ง

-44 dB

26

Page 27: Asst. Prof. Dr.  Peerapol Yuvapoositanon ,  PhD,DIC Department of Electronic Engineering  and

EEET0770 Digital Filter Design

Centre of Electronic Systems and Digital Signal Processing

EEET0770 Digital Filter Design

หน�าตั#าง แบล4กแมน

-74 dB

27

Page 28: Asst. Prof. Dr.  Peerapol Yuvapoositanon ,  PhD,DIC Department of Electronic Engineering  and

EEET0770 Digital Filter Design

Centre of Electronic Systems and Digital Signal Processing

EEET0770 Digital Filter Design

Digital Filter Design (DFD) Module

1

23

28

Page 29: Asst. Prof. Dr.  Peerapol Yuvapoositanon ,  PhD,DIC Department of Electronic Engineering  and

EEET0770 Digital Filter Design

Centre of Electronic Systems and Digital Signal Processing

EEET0770 Digital Filter Design

LabVIEW program

29

Page 30: Asst. Prof. Dr.  Peerapol Yuvapoositanon ,  PhD,DIC Department of Electronic Engineering  and

EEET0770 Digital Filter Design

Centre of Electronic Systems and Digital Signal Processing

EEET0770 Digital Filter Design

LabVIEW program

30

Page 31: Asst. Prof. Dr.  Peerapol Yuvapoositanon ,  PhD,DIC Department of Electronic Engineering  and

EEET0770 Digital Filter Design

Centre of Electronic Systems and Digital Signal Processing

EEET0770 Digital Filter Design

HighPass

31

Page 32: Asst. Prof. Dr.  Peerapol Yuvapoositanon ,  PhD,DIC Department of Electronic Engineering  and

EEET0770 Digital Filter Design

Centre of Electronic Systems and Digital Signal Processing

EEET0770 Digital Filter Design

Bandpass

32

Page 33: Asst. Prof. Dr.  Peerapol Yuvapoositanon ,  PhD,DIC Department of Electronic Engineering  and

EEET0770 Digital Filter Design

Centre of Electronic Systems and Digital Signal Processing

EEET0770 Digital Filter Design

Bandstop

33

Page 34: Asst. Prof. Dr.  Peerapol Yuvapoositanon ,  PhD,DIC Department of Electronic Engineering  and

EEET0770 Digital Filter Design

Centre of Electronic Systems and Digital Signal Processing

EEET0770 Digital Filter Design

Hanning

34

Page 35: Asst. Prof. Dr.  Peerapol Yuvapoositanon ,  PhD,DIC Department of Electronic Engineering  and

EEET0770 Digital Filter Design

Centre of Electronic Systems and Digital Signal Processing

EEET0770 Digital Filter Design

Hamming

35

Page 36: Asst. Prof. Dr.  Peerapol Yuvapoositanon ,  PhD,DIC Department of Electronic Engineering  and

EEET0770 Digital Filter Design

Centre of Electronic Systems and Digital Signal Processing

EEET0770 Digital Filter Design

Blackman-Harris

36

Page 37: Asst. Prof. Dr.  Peerapol Yuvapoositanon ,  PhD,DIC Department of Electronic Engineering  and

EEET0770 Digital Filter Design

Centre of Electronic Systems and Digital Signal Processing

EEET0770 Digital Filter Design

ตั�วอย#างที่��2จงออกแบบต!วกรองต.#าผ�าน ท�#มี�ความีถี�#ต!ด้ 2 kHz โด้ยต�องการ

0.003

45 dB

200 Hz

10 kHz

p

s

s

A

f

f

จงห้า ห้น�าต�างแบบท�#ใชิ�ได้� และ ใชิ�ได้�ท�#อ!นด้!บท�#เท�าไร?

37

Page 38: Asst. Prof. Dr.  Peerapol Yuvapoositanon ,  PhD,DIC Department of Electronic Engineering  and

EEET0770 Digital Filter Design

Centre of Electronic Systems and Digital Signal Processing

EEET0770 Digital Filter Design

1 เป็ร�ยบเที่�ยบร�ป็เป็2$ ล

เป็ร�ยบเท�ยบ และ p sAเล อกใชิ�ต!วท�# น�อยกว�า ในการออกแบบ

1020logs sA

เพัราะฉะน!,น

จาก45

20 2010 10 0.0056sA

s

dB

0.003

0.0056

p

s

เป็ร�ยบเท�ยบ ความีต�องการ

ด้!งน!,น ในการออกแบบจะเล อกใชิ� pd

38

Page 39: Asst. Prof. Dr.  Peerapol Yuvapoositanon ,  PhD,DIC Department of Electronic Engineering  and

EEET0770 Digital Filter Design

Centre of Electronic Systems and Digital Signal Processing

EEET0770 Digital Filter Design

2. เล�อกหน�าตั#าง ใชิ� ค�าร�ป็เป็2, ลท�#แถีบผ�าน ในการ เล อกห้น�าต�าง

0.003p 0.3%p จากตาราง 7.2 เราเห้4นว�า ห้น�าต�างท�#ให้�ค�าร�ป็เป็2, ลเก�น 0.3 % ค อ ห้น�าต�างส�#เห้ล�#ยมี (8.9%) และห้น�าต�างฮานน�#ง (0.63%) เพัราะฉะน!,น ห้น�าต�างท�#ใชิ�ได้� ค อ ห้น�าต�างแฮมีมี�#ง (0.22%)

ห้น�าต�างแบล4กแมีน (0.02%)

39

Page 40: Asst. Prof. Dr.  Peerapol Yuvapoositanon ,  PhD,DIC Department of Electronic Engineering  and

EEET0770 Digital Filter Design

Centre of Electronic Systems and Digital Signal Processing

EEET0770 Digital Filter Design

หน�าตั#างแฮมม��ง (0 .2 2 %)

2 2 20000.4 radians

10000c

cs

f

f

2 2 (200)0.04 radians

10000s

f

f

8

N

8 8

2000.04

N

อ!นด้!บ ค อจ.านวนเต4มีเลข้คี่��ท�#มีากกว�า 200 น!#นค อ N=201

ความีถี�#ต!ด้ด้�จ�ตอล

แถีบความีถี�#เป็ล�#ยน ด้�จ�ตอล

จากตารางท�# 7.2 ห้น�าต�างแฮมีมี�#ง

ห้าอ!นด้!บของต!วกรอง

40

Page 41: Asst. Prof. Dr.  Peerapol Yuvapoositanon ,  PhD,DIC Department of Electronic Engineering  and

EEET0770 Digital Filter Design

Centre of Electronic Systems and Digital Signal Processing

EEET0770 Digital Filter Design

หน�าตั#างแบล4กแมน (0.02%)

12

N

12 12300

0.04N

อ!นด้!บ ค อจ.านวนเต4มีเลข้คี่��ท�#มีากกว�า 300 น!#นค อ N=301

จากตารางท�# 7.2 ห้น�าต�างแบล4กแมีน

ห้าอ!นด้!บ ของต!วกรอง

41

Page 42: Asst. Prof. Dr.  Peerapol Yuvapoositanon ,  PhD,DIC Department of Electronic Engineering  and

EEET0770 Digital Filter Design

Centre of Electronic Systems and Digital Signal Processing

EEET0770 Digital Filter Design

% window.m demonstrating of the window design techniquefc=500; fs=2000;N=41;M=(N-1)/2;wc=2*pi*fc/fs;n=0:N-1;%%%%%%% we can add a smallest number % 'eps' to avoid dividing by zero d=sin(wc*(n-M+eps))./(n-M+eps)/pi;%%%% uncomment lines below for different windows w=ones(1,N); % Rectangular% w=.5-.5*cos(2*pi*n./(N-1)); %Hanning% w=.42-.5*cos(2*pi*n./(N-1))+.08*cos(4*pi*n./(N-1)); %blackmanh=d.*w;figure(1);subplot(111);freqres(h,1,fs,'db')figure(2);subplot(111);stem(h)grid onxlabel('n')ylabel('h(n)')

42

Page 43: Asst. Prof. Dr.  Peerapol Yuvapoositanon ,  PhD,DIC Department of Electronic Engineering  and

EEET0770 Digital Filter Design

Centre of Electronic Systems and Digital Signal Processing

EEET0770 Digital Filter Design การออกแบบ FIR เที่คี่น�กการส*#ม คี่วามถ��

(Frequency Sampling Techniques)เป็�นการสร�างต!วกรองโด้ยใชิ� การส0�มีส!มีป็ระส�ทธี�6 จาก DFT

ซึ่-#งได้�เคยกล�าวถี-งไป็แล�ว ในบทท�# 7ใชิ�ในการสร�างต!วกรองท�#มี�ผลตอบสนองความีถี�#แป็ลกๆ( )jD e w

1

p p

( )jH e w

w w43

Page 44: Asst. Prof. Dr.  Peerapol Yuvapoositanon ,  PhD,DIC Department of Electronic Engineering  and

EEET0770 Digital Filter Design

Centre of Electronic Systems and Digital Signal Processing

EEET0770 Digital Filter Design

1

2 / 10

1 ( )( ) (1 )

1

NN

j k Nk

H kH z z

N e z

ในเชิ�งทฤษฎี� เราเห้4นว�ามี�ความีสอด้คล�องก!บเร #องของ“ FIR: Frequency Sampling” ใน DSP 7: โคี่รงสร�างตั�วกรองดิ�จิ�ตัอล

ท�# เราได้� h(n) จากการส0�มีค�าส!มีป็ระส�ทธี�6ของ DFT 1

2 /

0

1( ) ( )

Nj nk N

k

h n H k eN

และได้� ฟ1งก)ชิ!นถี�ายโอนเป็�น

44

Page 45: Asst. Prof. Dr.  Peerapol Yuvapoositanon ,  PhD,DIC Department of Electronic Engineering  and

EEET0770 Digital Filter Design

Centre of Electronic Systems and Digital Signal Processing

EEET0770 Digital Filter Design

การออกแบบตั�วกรองแบบส*#มคี่วามถ��( ) ( )j j M jD e e D e

1

2

NM

เราได้�

จาก

2( ) ( )j

kN

H k D e

2

( ) ( )k

j MNH k e H k

1

( ) ( )Nj kNH k e H k

0,1,..., 1k N

ข�อส.าค!ญ ( )H k ( )jD e wจะเท�าก!บ

เฉพัาะ ต.าแห้น�งท�#เราส0�มีเท�าน!,น

แทน

ด้!งน!,น

45

Page 46: Asst. Prof. Dr.  Peerapol Yuvapoositanon ,  PhD,DIC Department of Electronic Engineering  and

EEET0770 Digital Filter Design

Centre of Electronic Systems and Digital Signal Processing

EEET0770 Digital Filter Design

เล�อก N เป็�นเลข้คี่�� คี่รอบคี่ล*ม( )jD e w

1

k

p 2p

2p

0 1 2 3 2010

w

46

Page 47: Asst. Prof. Dr.  Peerapol Yuvapoositanon ,  PhD,DIC Department of Electronic Engineering  and

EEET0770 Digital Filter Design

Centre of Electronic Systems and Digital Signal Processing

EEET0770 Digital Filter Design

ต!วอย�าง

ว�ธี�ท.า

ห้าส!มีป็ระส�ทธี�6ของต!วกรอง FIR แบบต.#าผ�าน ท�#ความีถี�#ต!ด้ 2 kHz ความีถี�#ส0�มี (fs) 10 kHz ก.าห้นด้ให้�เราส0�มี 21 จ0ด้

2 2 20000.4 radians

10000c

cs

f

f

ความีถี�#ต!ด้ ด้�จ�ตอล

ห้าจ.านวนจ0ด้ ของ ย�านแถีบผ�าน= (0.4 )(21) / 2 5

ด้!งน!,นจ.านวนจ0ด้ ของ ย�านแถีบห้ย0ด้= 11 5 6

47

Page 48: Asst. Prof. Dr.  Peerapol Yuvapoositanon ,  PhD,DIC Department of Electronic Engineering  and

EEET0770 Digital Filter Design

Centre of Electronic Systems and Digital Signal Processing

EEET0770 Digital Filter Design

การส*#มเพิ��อให�ไดิ�ตั�วกรองที่��ตั�องการ( )jD e

1

p0.4

20

21( ) ( )j k

H k e H k

48

Page 49: Asst. Prof. Dr.  Peerapol Yuvapoositanon ,  PhD,DIC Department of Electronic Engineering  and

EEET0770 Digital Filter Design

Centre of Electronic Systems and Digital Signal Processing

EEET0770 Digital Filter Design

ex_8_8.eps

กรณ�ส*#ม 21 จิ*ดิ

49

Page 50: Asst. Prof. Dr.  Peerapol Yuvapoositanon ,  PhD,DIC Department of Electronic Engineering  and

EEET0770 Digital Filter Design

Centre of Electronic Systems and Digital Signal Processing

EEET0770 Digital Filter Design

เพิ��มจิ&านวนจิ*ดิส*#มเป็�น 61 จิ*ดิ

ห้าจ.านวนจ0ด้ ของ ย�านแถีบผ�าน= (0.4 )(61) / 2 13

ด้!งน!,นจ.านวนจ0ด้ ของ ย�านแถีบห้ย0ด้= 31 13 18

60

61( ) ( )j k

H k e H k

50

Page 51: Asst. Prof. Dr.  Peerapol Yuvapoositanon ,  PhD,DIC Department of Electronic Engineering  and

EEET0770 Digital Filter Design

Centre of Electronic Systems and Digital Signal Processing

EEET0770 Digital Filter Design

กรณ�ส*#ม 61 จิ*ดิ

โลบข�างมี�ขนาด้เท�าก!บ กรณี�ส0�มี 21 จ0ด้

ex_8_9.eps

ความีชิ!นมีากข-,น

51

Page 52: Asst. Prof. Dr.  Peerapol Yuvapoositanon ,  PhD,DIC Department of Electronic Engineering  and

EEET0770 Digital Filter Design

Centre of Electronic Systems and Digital Signal Processing

EEET0770 Digital Filter Design

% freq_sampl.m demonstrating low-pass design for FIR % fs=10000; % ความีถี�#ส0�มี 10 kHzwc= 0.4*pi; % ความีถี�#ต!ด้ด้�จ�ตอล N=21; % เล อกจ.านวนจ0ด้ส0�มีเป็�นเลขค�# Mp= ceil(wc*N/(2*pi)); %จ.น. จ0ด้ ของแถีบผ�าน 0<w<pi Mpp=Mp-1; %จ.น. จ0ด้ ของแถีบผ�าน pi<w<2pi Ms= N-Mp-Mpp; %จ.น. จ0ด้ ของแถีบห้ย0ด้ 0<w<piH=[ones(1,Mp) zeros(1,Ms) ones(1,Mpp)]; %ขนาด้ของต!วกรอง k=0:1:N-1; % มี� N ความีถี�# H=H.*exp(-j*pi*(N-1)*k/N); % ต!วกรอง=ขนาด้*เฟสh=real(ifft(H)); %ผลตอบสนองอ�มีพั!ลส)เป็�นค�าจร�งfigure(1)freqres(h,1,fs)

52

Page 53: Asst. Prof. Dr.  Peerapol Yuvapoositanon ,  PhD,DIC Department of Electronic Engineering  and

EEET0770 Digital Filter Design

Centre of Electronic Systems and Digital Signal Processing

EEET0770 Digital Filter Design

สร*ป็• การออกแบบต!วกรอง FIR ท.าได้�สองแบบ ค อ การออกแบบโด้ยว�ธี�

ห้น�าต�าง (Window Method) และ การออกแบบ FIR โด้ยเทคน�กส0�มีความีถี�# (Frequency Sampling Method)

• แต� ส.าห้ร!บ FIR ท�#เป็�นแบบ มีาตรฐาน การออกแบบโด้ยว�ธี�ห้น�าต�าง• ห้น�าต�างแต�ละแบบให้�จ0ด้เด้�น จ0ด้ด้�อยต�างก!น• การออกแบบโด้ยว�ธี�ส0�มีความีถี�# ท.าให้�สามีารถีออกแบบต!วกรองได้�

จาก ผลตอบสนองความีถี�#ได้�โด้ยตรง• จ.านวนส0�มีมีากจะเพั�#มีความีชิ!นของแถีบ แต�ก4ท.าให้�อ!นด้!บของต!ว

กรองมีากข-,นด้�วย

53