Professional Documents
Culture Documents
Toolbox
For Use with MATLAB ®
Computation
Visualization
Programming
User’s Guide
Version 4.2
How to Contact The MathWorks:
☎
PHONE
508-647-7000 P h on e
508-647-7001 Fax
FAX
✉
MAIL
Th e Ma t h Wor ks, In c.
24 P r im e P a r k Wa y
Na t ick, MA 01760-1500
Ma il
http://www.mathworks.com Web
INTERNET
ftp.mathworks.com An on ym ou s F TP ser ver
comp.soft-sys.matlab Newsgr ou p
@ support@mathworks.com
suggest@mathworks.com
Tech n ica l su ppor t
P r odu ct en h a n cem en t su ggest ion s
bugs@mathworks.com Bu g r epor t s
doc@mathworks.com Docu m en t a t ion er r or r epor t s
subscribe@mathworks.com Su bscr ibin g u ser r egist r a t ion
service@mathworks.com Or der st a t u s, licen se r en ewa ls, pa sscodes
info@mathworks.com Sa les, pr icin g, a n d gen er a l in for m a t ion
B e fo re Yo u B e g in
Wh a t Is th e S ig n a l P ro c e s s in g To o lbo x ? . . . . . . . . . . . . . . . . . . . x i i
Ho w to U s e Th is Ma n u a l . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . x ii i
In s ta lla tio n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . x v
Ty p o g ra p h ic a l Co n v e n tio n s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . x v i
Tech n ica l Not a t ion s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . x v i i
S ig n a l P ro c e s s in g B a s ic s
1
S ig n a l P ro c e s s in g To o lbo x Ce n tra l F e a tu re s . . . . . . . . . . . . . . 1-2
F ilt er in g a n d F F Ts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2
Sign a ls a n d Syst em s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2
Key Ar ea s: F ilt er Design a n d Spect r a l An a lysis . . . . . . . . . . . . 1-3
Gr a ph ica l User In t er fa ce (GUI) . . . . . . . . . . . . . . . . . . . . . . . . . 1-3
E xt en sibilit y . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3
Re p re s e n tin g S ig n a ls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-4
Vect or Repr esen t a t ion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-4
i
Wo rk in g w it h D a t a . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-13
Im p u ls e Re s p o n s e . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-23
F re qu e n c y Re s p o n s e . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-24
Digit a l Dom a in . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-24
An a log Dom a in . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-26
Ma gn it u de a n d P h a se . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-26
Dela y . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-28
Ze ro -P o le An a ly s is . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-30
Lin e a r S y s t e m Mo d e ls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-32
Discr et e-Tim e Syst em Models . . . . . . . . . . . . . . . . . . . . . . . . . . 1-32
Tr a n sfer F u n ct ion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-32
Zer o-P ole-Ga in . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-33
St a t e-Spa ce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-34
P a r t ia l F r a ct ion E xpa n sion (Residu e F or m ) . . . . . . . . . . . . 1-35
Secon d-Or der Sect ion s (SOS) . . . . . . . . . . . . . . . . . . . . . . . . 1-36
La t t ice St r u ct u r e . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-37
Con volu t ion Ma t r ix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-39
Con t in u ou s-Tim e Syst em Models . . . . . . . . . . . . . . . . . . . . . . . 1-40
Lin ea r Syst em Tr a n sfor m a t ion s . . . . . . . . . . . . . . . . . . . . . . . . 1-41
ii Con ten ts
D is c re te F o u rie r Tra n s fo rm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-43
Re fe re n c e s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-46
F ilte r D e s ig n
2
F ilte r Re qu ire m e n ts a n d S p e c ific a tio n . . . . . . . . . . . . . . . . . . . . 2-2
F IR F ilte r D e s ig n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-16
Lin ea r P h a se F ilt er s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-17
Win dowin g Met h od . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-18
St a n da r d Ba n d F IR F ilt er Design : fir 1 . . . . . . . . . . . . . . . . 2-20
Mu lt iba n d F IR F ilt er Design : fir 2 . . . . . . . . . . . . . . . . . . . . 2-21
Mu lt iba n d F IR F ilt er Design wit h Tr a n sit ion Ba n ds . . . . . . . 2-22
Ba sic Con figu r a t ion s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-22
Th e Weigh t Vect or . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-24
An t i-Sym m et r ic F ilt er s / H ilber t Tr a n sfor m er s . . . . . . . . . . 2-25
Differ en t ia t or s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-26
Con st r a in ed Lea st Squ a r es F IR F ilt er Design . . . . . . . . . . . . . 2-27
Ba sic Lowpa ss a n d H igh pa ss CLS F ilt er Design . . . . . . . . . 2-28
Mu lt iba n d CLS F ilt er Design . . . . . . . . . . . . . . . . . . . . . . . . 2-29
Weigh t ed CLS F ilt er Design . . . . . . . . . . . . . . . . . . . . . . . . . 2-30
i ii
Ar bit r a r y-Respon se F ilt er Design . . . . . . . . . . . . . . . . . . . . . . . 2-31
Mu lt iba n d F ilt er Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-32
F ilt er Design wit h Redu ced Dela y . . . . . . . . . . . . . . . . . . . . 2-34
Re fe re n c e s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-46
S ta tis t ic a l S ig n a l P ro c e s s in g
3
Co rre la tio n a n d Co v a ria n c e . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2
Bia s a n d Nor m a liza t ion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-3
Mu lt iple Ch a n n els . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-4
S p e c tra l An a ly s is . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-5
Welch ’s Met h od . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6
P ower Spect r a l Den sit y F u n ct ion . . . . . . . . . . . . . . . . . . . . . 3-10
Bia s a n d Nor m a liza t ion in Welch ’s Met h od . . . . . . . . . . . . . 3-12
Cr oss-Spect r a l Den sit y F u n ct ion . . . . . . . . . . . . . . . . . . . . . 3-14
Con fiden ce In t er va ls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-14
Tr a n sfer F u n ct ion E st im a t e . . . . . . . . . . . . . . . . . . . . . . . . . 3-14
Coh er en ce F u n ct ion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-15
Mu lt it a per Met h od . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-16
Yu le-Wa lker AR Met h od . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-19
Bu r g Met h od . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-20
Cova r ia n ce a n d Modified Cova r ia n ce Met h ods . . . . . . . . . . . . 3-22
MUSIC a n d E igen vect or An a lysis Met h ods . . . . . . . . . . . . . . . 3-23
E igen a n a lysis Over view . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-24
Con t r ollin g Su bspa ce Th r esh olds . . . . . . . . . . . . . . . . . . . . . 3-25
iv Con ten ts
Re fe re n c e s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-27
S p e c ia l To p ic s
4
Win d o w s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2
Ba sic Sh a pes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2
Gen er a lized Cosin e Win dows . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-4
Ka iser Win dow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-4
Ka iser Win dows in F IR Design . . . . . . . . . . . . . . . . . . . . . . . . 4-7
Ch ebysh ev Win dow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-9
Re s a m p lin g . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-20
Ce p s tru m An a ly s is . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-23
In ver se Com plex Cepst r u m . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-25
D e c o n v o lu t io n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-33
v
Re fe re n c e s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-40
In te ra c tiv e To o ls
5
S P To o l: An In te ra c tiv e S ig n a l P ro c e s s in g En v iro n m e n t . . . 5-2
Over view . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2
U s in g S P To o l . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-3
Open in g SP Tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-3
Qu ick St a r t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-3
E xa m ple: Im por t in g Sign a l Da t a fr om a MAT-F ile . . . . . . . . 5-3
Ba sic SP Tool F u n ct ion s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-5
F ile Men u . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-6
H elp Men u . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-6
Im por t in g Sign a ls, F ilt er s, a n d Spect r a . . . . . . . . . . . . . . . . . . . 5-7
Loa din g Va r ia bles fr om t h e MATLAB Wor kspa ce . . . . . . . . 5-7
Loa din g Va r ia bles fr om Disk . . . . . . . . . . . . . . . . . . . . . . . . . 5-8
Im por t in g Wor kspa ce Con t en t s a n d F ile Con t en t s . . . . . . . . 5-8
Wor kin g wit h Sign a ls, F ilt er s, a n d Spect r a . . . . . . . . . . . . . . . 5-13
Com pon en t List s in SP Tool . . . . . . . . . . . . . . . . . . . . . . . . . . 5-14
Select in g Da t a Object s in SP Tool . . . . . . . . . . . . . . . . . . . . . 5-15
E dit in g Da t a Object s in SP Tool . . . . . . . . . . . . . . . . . . . . . . 5-15
Viewin g a Sign a l . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-17
Viewin g a F ilt er . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-17
Design in g a F ilt er . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-17
Applyin g a F ilt er . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-18
Cr ea t in g a Spect r u m . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-19
Viewin g a Spect r u m . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-19
Upda t in g a Spect r u m . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-19
vi Con ten ts
Cu st om izin g P r efer en ces . . . . . . . . . . . . . . . . . . . . ......... . 5-20
Ru ler Set t in gs . . . . . . . . . . . . . . . . . . . . . . . . . . ......... . 5-21
Color Set t in gs . . . . . . . . . . . . . . . . . . . . . . . . . . . ......... . 5-22
Sign a l Br owser Set t in gs . . . . . . . . . . . . . . . . . . ......... . 5-23
Spect r u m Viewer Set t in gs . . . . . . . . . . . . . . . . . ......... . 5-24
F ilt er Viewer Set t in gs . . . . . . . . . . . . . . . . . . . . ......... . 5-25
F ilt er Viewer Tilin g Set t in gs . . . . . . . . . . . . . . ......... . 5-26
F ilt er Design er Set t in gs . . . . . . . . . . . . . . . . . . ......... . 5-27
Defa u lt Session Set t in g . . . . . . . . . . . . . . . . . . . ......... . 5-28
E xpor t in g Com pon en t s Set t in g . . . . . . . . . . . . . ......... . 5-29
P lu g-In s Set t in g . . . . . . . . . . . . . . . . . . . . . . . . . ......... . 5-30
Sa vin g a n d Disca r din g Ch a n ges t o P r efer en ces Set t in gs . . 5-30
Con t r ols for Viewin g a n d Mea su r in g . . . . . . . . . . ......... . 5-31
Zoom Con t r ols . . . . . . . . . . . . . . . . . . . . . . . . . . ......... . 5-31
Ru ler Con t r ols . . . . . . . . . . . . . . . . . . . . . . . . . . ......... . 5-33
Ma k in g Sign a l Mea su r em en t s . . . . . . . . . . . . . ......... . 5-37
U s in g t h e S ig n a l B ro w s e r: In te ra c tiv e S ig n a l An a ly s is . . . 5-43
Open in g t h e Sign a l Br owser . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-43
Ba sic Sign a l Br owser F u n ct ion s . . . . . . . . . . . . . . . . . . . . . . . . 5-44
Men u s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-45
Zoom Con t r ols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-46
Ru ler a n d Lin e Displa y Con t r ols . . . . . . . . . . . . . . . . . . . . . 5-46
H elp Bu t t on . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-46
Displa y Ma n a gem en t Con t r ols . . . . . . . . . . . . . . . . . . . . . . . 5-47
Ma in Axes Displa y Ar ea . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-47
P a n n er . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-48
Ma k in g Sign a l Mea su r em en t s . . . . . . . . . . . . . . . . . . . . . . . 5-49
Viewin g a n d E xplor in g Sign a ls . . . . . . . . . . . . . . . . . . . . . . . . . 5-49
Select in g a n d Displa yin g a Sign a l . . . . . . . . . . . . . . . . . . . . 5-49
P a n n er Displa y . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-52
Ma n ipu la t in g Displa ys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-53
Wor kin g wit h Sign a ls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-54
P r in t in g Sign a l Da t a . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-54
Sa vin g Sign a l Da t a . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-57
v ii
Ba sic F ilt er Design er F u n ct ion s . . . . . . . . . . . . . . . . . . . . . . . . 5-60
Men u s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-60
F ilt er P op-Up Men u . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-60
Zoom Con t r ols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-61
H elp Bu t t on . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-61
Gen er a l Con t r ols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-62
F ilt er Specifica t ion s P a n el—Design Met h ods . . . . . . . . . . . 5-63
F ilt er Mea su r em en t s P a n el—Design Met h ods . . . . . . . . . . 5-65
F ilt er Specifica t ion s P a n el—P ole/Zer o E dit or . . . . . . . . . . . 5-66
F ilt er Mea su r em en t s P a n el—P ole/Zer o E dit or . . . . . . . . . . 5-68
Ma gn it u de P lot (Displa y) Ar ea —Design Met h ods . . . . . . . . 5-69
Ma gn it u de P lot (Displa y) Ar ea —P ole/Zer o E dit or . . . . . . . . 5-71
Design in g F in it e Im pu lse Respon se (F IR) F ilt er s . . . . . . . . . . 5-73
E xa m ple: F IR F ilt er Design , St a n da r d Ba n d Con figu r a t ion 5-73
F ilt er Design Opt ion s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-75
Or der Select ion for F IR F ilt er Design . . . . . . . . . . . . . . . . . 5-75
Design in g In fin it e Im pu lse Respon se (IIR) F ilt er s . . . . . . . . . 5-76
E xa m ple: Cla ssica l IIR F ilt er Design . . . . . . . . . . . . . . . . . . 5-76
F ilt er Design Opt ion s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-77
Or der Select ion for IIR F ilt er Design . . . . . . . . . . . . . . . . . . 5-78
Redesign in g a F ilt er Usin g t h e Ma gn it u de P lot . . . . . . . . . . . . 5-78
Sa vin g F ilt er Da t a . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-79
Viewin g F r equ en cy Respon se P lot s . . . . . . . . . . . . . . . . . . . . . . 5-82
v ii i Con ten ts
Viewin g F ilt er P lot s . . . . . . . . . . . ... ... .... ... ... ... ... . 5-89
Viewin g Ma gn it u de Respon se . ... ... .... ... ... ... ... . 5-89
Viewin g P h a se Respon se . . . . . ... ... .... ... ... ... ... . 5-91
Viewin g Gr ou p Dela y . . . . . . . . ... ... .... ... ... ... ... . 5-93
Viewin g a Zer o-P ole P lot . . . . . ... ... .... ... ... ... ... . 5-94
Viewin g Im pu lse Respon se . . . ... ... .... ... ... ... ... . 5-94
Viewin g St ep Respon se . . . . . . ... ... .... ... ... ... ... . 5-95
Re fe re n c e
6
ix
x Con ten ts
Befor e You Begin
Wh a t Is th e S ig n a l P ro c e s s in g To o lbo x ? . . . . . . . . . . . . . . . .xii
Ho w to U s e Th is Ma n u a l . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiii
In s ta lla tio n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv
Ty p o g ra p h ic a l Co n v e n tio n s . . . . . . . . . . . . . . . . . . . . . . . . . . xvi
Tech n ica l Not a t ion s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xvii
Before You Begin
x ii
How to Use This Manual
If you are an experienced toolbox user. See Ch a pt er 5, “In t er a ct ive Tools,” for a n
over view of t h e in t er a ct ive GUI en vir on m en t a n d exa m ples of h ow t o u se it for
sign a l viewin g, filt er design a n d im plem en t a t ion , a n d spect r a l a n a lysis.
x iii
Before You Begin
All toolbox users. Use Ch a pt er 6, “Refer en ce,” for loca t in g in for m a t ion on specific
fu n ct ion s. Refer en ce descr ipt ion s in clu de a syn opsis of t h e fu n ct ion ’s syn t a x, a s
well a s a com plet e expla n a t ion of opt ion s a n d oper a t ion s. Ma n y r efer en ce
descr ipt ion s a lso in clu de h elpfu l exa m ples, a descr ipt ion of t h e fu n ct ion ’s
a lgor it h m , a n d r efer en ces t o a ddit ion a l r ea din g m a t er ia l.
Use t h is m a n u a l in con ju n ct ion wit h t h e soft wa r e t o lea r n a bou t t h e power fu l
fea t u r es t h a t MATLAB pr ovides. E a ch ch a pt er pr ovides n u m er ou s exa m ples
t h a t a pply t h e t oolbox t o r epr esen t a t ive sign a l pr ocessin g t a sk s.
Som e exa m ples u se MATLAB’s r a n dom n u m ber gen er a t ion fu n ct ion randn. In
t h ese ca ses, t o du plica t e t h e r esu lt s in t h e exa m ple, t ype
randn('seed',0)
x iv
Installation
Installation
To in st a ll t h is t oolbox on a wor kst a t ion , see t h e M AT L AB In stallation Gu id e
for UN IX. To in st a ll t h e t oolbox on a P C, see t h e M AT L AB PC In stallation
Gu id e.
To det er m in e if t h e Sign a l P r ocessin g Toolbox is a lr ea dy in st a lled on you r
syst em , ch eck for a su bdir ect or y n a m ed signal wit h in t h e m a in t oolbox
dir ect or y or folder .
xv
Before You Begin
Typographical Conventions
A = 5
xvi
Typographical Conventions
Technical Notations
Th is m a n u a l a n d t h e Sign a l P r ocessin g Toolbox fu n ct ion s u se t h e followin g
t ech n ica l n ot a t ion s:
x v ii
Before You Begin
x v iii
1
Re p re s e n tin g S ig n a ls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-4
Wo rk in g w ith D a ta . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-13
Im p u ls e Re s p o n s e . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-23
F re qu e n c y Re s p o n s e . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-24
Ze ro -P o le An a ly s is . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-30
Lin e a r S y s te m Mo d e ls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-32
Re fe re n c e s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-46
1 Signal Processing Basics
1-2
Signal Processing Toolbox Central Features
Extensibility
P er h a ps t h e m ost im por t a n t fea t u r e of t h e MATLAB en vir on m en t is t h a t it is
ext en sible: MATLAB let s you cr ea t e you r own M-files t o m eet n u m er ic
com pu t a t ion n eeds for r esea r ch , design , or en gin eer in g of sign a l pr ocessin g
syst em s. Sim ply copy t h e M-files pr ovided wit h t h e Sign a l P r ocessin g Toolbox
a n d m odify t h em a s n eeded, or cr ea t e n ew fu n ct ion s t o expa n d t h e fu n ct ion a lit y
of t h e t oolbox.
1-3
1 Signal Processing Basics
Representing Signals
Th e cen t r a l da t a con st r u ct in MATLAB is t h e n u m eric array, a n or der ed
collect ion of r ea l or com plex n u m er ic da t a wit h t wo or m or e dim en sion s. Th e
ba sic da t a object s of sign a l pr ocessin g (on e-dim en sion a l sign a ls or sequ en ces,
m u lt ich a n n el sign a ls, a n d t wo-dim en sion a l sign a ls) a r e a ll n a t u r a lly su it ed t o
a r r a y r epr esen t a t ion .
Vector Representation
MATLAB r epr esen t s or din a r y on e-dim en sion a l sa m pled da t a sign a ls, or
sequ en ces, a s vectors. Vect or s a r e 1-by-n or n -by-1 a r r a ys, wh er e n is t h e
n u m ber of sa m ples in t h e sequ en ce. On e wa y t o in t r odu ce a sequ en ce in t o
MATLAB is t o en t er it a s a list of elem en t s a t t h e com m a n d pr om pt . Th e
st a t em en t
x = [4 3 7 –9 1]
r esu lt in g in
x =
4
3
7
–9
1
Colu m n or ien t a t ion is pr efer a ble for sin gle ch a n n el sign a ls beca u se it ext en ds
n a t u r a lly t o t h e m u lt ich a n n el ca se. F or m u lt ich a n n el da t a , ea ch colu m n of a
m a t r ix r epr esen t s on e ch a n n el. E a ch r ow of su ch a m a t r ix t h en cor r espon ds t o
a sa m ple poin t . A t h r ee-ch a n n el sign a l t h a t con sist s of x, 2x, a n d x/π is
y = [x 2*x x/pi]
1-4
Representing Signals
Th is r esu lt s in
y =
1-5
1 Signal Processing Basics
-1
-2
-3
-4
0 0.01 0.02 0.03 0.04 0.05
1-6
Waveform Generation: Time Vectors and Sinusoids
Multichannel Signals
Use st a n da r d MATLAB a r r a y syn t a x t o wor k wit h m u lt ich a n n el sign a ls. F or
exa m ple, a m u lt ich a n n el sign a l con sist in g of t h e la st t h r ee sign a ls gen er a t ed
a bove is
z = [t t.^2 square(4*t)];
1-7
1 Signal Processing Basics
0.5
-0.5
-1
0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.16 0.18 0.2
1-8
Waveform Generation: Time Vectors and Sinusoids
500
450
400
350
300
Frequency
250
200
150
100
50
0
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6
Time
1-9
1 Signal Processing Basics
0.8
0.6
0.4
0.2
-0.2
-0.4
-0.6
-0.8
0 0.001 0.002 0.003 0.004 0.005 0.006 0.007 0.008 0.009 0.01
sin ( πx )
--------------------
πx
for a ll ot h er elem en t s of x.
1-10
Waveform Generation: Time Vectors and Sinusoids
To plot t h e sin c fu n ct ion for a lin ea r ly spa ced vect or wit h va lu es r a n gin g fr om
–5 t o 5,
x = linspace(–5,5);
y = sinc(x);
plot(x,y)
0.8
0.6
0.4
0.2
-0.2
-0.4
-5 -4 -3 -2 -1 0 1 2 3 4 5
⎧ – 1 k ( n – 1 ) x = 2 πk , k = 0 , ±1 , ±2 , …
⎪
dir ic(x ) = ⎨
sin ( n x ⁄ 2 )
⎪ --------------------------- otherwise
-
⎩ n sin ( x ⁄ 2 )
wh er e n is a u ser -specified posit ive in t eger . F or n odd, t h e Dir ich let fu n ct ion
h a s a per iod of 2π; for n even , it s per iod is 4π. Th e m a gn it u de of t h is fu n ct ion is
(1/n ) t im es t h e m a gn it u de of t h e discr et e-t im e F ou r ier t r a n sfor m of t h e n -poin t
r ect a n gu la r win dow.
1-11
1 Signal Processing Basics
n=7 n=8
1 1
0.8
0.5
0.6
0.4
0
0.2
0
-0.5
-0.2
-0.4 -1
0 5 10 15 0 5 10 15
1-12
Working with Data
1-13
1 Signal Processing Basics
ans =
1 2 3 2 1
NOTE Con volve r ect a n gu la r m a t r ices for t wo-dim en sion a l sign a l pr ocessin g
u sin g t h e conv2 fu n ct ion .
y (n ) = h (n ) ∗ x (n ) = ∑ h (n – m )x (m )
m = –∞
1-14
Filter Implementation and Analysis
b (1 ) + b (2 )z – 1 + L+ b (n b + 1 )z – n b
Y (z ) = H (z )X (z ) = ----------------------------------------------------------------------------------------
- X (z )
a (1 ) + a (2 )z – 1 + L+ a (n a + 1 )z –n a
wh er e H (z) is t h e filt er ’s tran sfer fu n ction . H er e, t h e con st a n t s b(i) a n d a(i) a r e
t h e filt er coefficien t s a n d t h e or der of t h e filt er is t h e m a xim u m of n a a n d n b.
1-15
1 Signal Processing Basics
y (n ) + a (2 )y (n – 1 ) + L+ a (n a + 1 )y (n – n a ) = b (1 )x (n ) + b (2 )x (n – 1 ) + L+ b (n b + 1 )x (n – n b )
In t er m s of cu r r en t a n d pa st in pu t s, a n d pa st ou t pu t s, y(n ) is
y (n ) = b (1 )x (n ) + b (2 )x (n – 1 ) + L+ b (n b + 1 )x (n – n b ) – a (2 )y (n – 1 ) – L– a (n a + 1 ) y (n – n a )
y (1 ) = b (1 )x (1 )
y (2 ) = b (1 )x (2 ) + b (2 )x (1 ) – a (2 )y (1 )
y (3 ) = b (1 )x (3 ) + b (2 )x (2 ) + b (3 )x (1 ) – a (2 )y (2 ) – a (3 )y (1 )
M = M
A filt er in t h is for m is ea sy t o im plem en t wit h t h e filter fu n ct ion . F or
exa m ple, a sim ple sin gle-pole filt er (lowpa ss) is
b = 1; % numerator
a = [1 –0.9]; % denominator
1-16
filter Function Implementation and Initial Conditions
Σ z -1 ... Σ z -1 Σ z -1 Σ y(m)
z n -1 (m) z 2 (m) z 1 (m)
– a(n) – a( 3 ) – a( 2 )
...
y (m ) = b (1 )x (m ) + z 1 (m – 1 )
z 1 (m ) = b (2 )x (m ) + z 2 (m – 1 ) – a (2 )y (m )
M = M
zn – 2 (m ) = b (n – 1 )x (m ) + z n – 1 (m – 1 ) – a (n – 1 )y (m )
zn – 1 (m ) = b (n )x (m ) – a (n )y (m )
Access t o in it ia l a n d fin a l con dit ion s is u sefu l for filt er in g da t a in sect ion s,
especia lly if m em or y lim it a t ion s a r e a con sider a t ion . Su ppose you h a ve
collect ed da t a in t wo segm en t s of 5000 poin t s ea ch .
x1 = randn(5000,1); % two random sequences to
x2 = randn(5000,1); % serve as simulated data
1-17
1 Signal Processing Basics
Th e filtic fu n ct ion gen er a t es in it ia l con dit ion s for filter. filtic com pu t es
t h e dela y vect or t o m a ke t h e beh a vior of t h e filt er r eflect pa st in pu t s a n d
ou t pu t s t h a t you specify. To obt a in t h e sa m e ou t pu t dela y va lu es zf a s a bove
u sin g filtic
zf = filtic(b,a,flipud(y1),flipud(x1));
1-18
Other Functions for Filtering
FIR
x(n) P H Q y(n)
1-19
1 Signal Processing Basics
Time Time
X(z) H(z) Reverse H(z) Reverse X(z)H(1/z)H(z)
1-20
Other Functions for Filtering
1.5
0.5
-0.5
-1
-1.5
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
1-21
1 Signal Processing Basics
1-22
Impulse Response
Impulse Response
Th e im pu lse r espon se of a digit a l filt er is t h e ou t pu t a r isin g fr om t h e in pu t
sequ en ce
⎧ 1 , n =1
x (n ) = ⎨
⎩ 0 , n ≠1
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0
0 10 20 30 40 50 60 70 80 90
Th e plot sh ows t h e expon en t ia l deca y h(n) = 0.9n of t h e sin gle pole syst em .
1-23
1 Signal Processing Basics
Frequency Response
Th e Sign a l P r ocessin g Toolbox en a bles you t o per for m fr equ en cy dom a in
a n a lysis of bot h a n a log a n d digit a l filt er s.
Digital Domain
freqz u ses a n F F T-ba sed a lgor it h m t o ca lcu la t e t h e z-t r a n sfor m fr equ en cy
r espon se of a digit a l filt er . Specifica lly, t h e st a t em en t
[h,w] = freqz(b,a,n)
b (1 ) + b (2 )e – j ω + L+ b (n b + 1 )e – j ω ( n b )
H (e j ω) = ----------------------------------------------------------------------------------------------------
a (1 ) + a (2 )e – j ω + L+ a (n a + 1 )e – j ω ( n a )
In it s sim plest for m , freqz a ccept s t h e filt er coefficien t vect or s b a n d a, a n d a n
in t eger n specifyin g t h e n u m ber of poin t s a t wh ich t o ca lcu la t e t h e fr equ en cy
r espon se. freqz r et u r n s t h e com plex fr equ en cy r espon se in vect or h, a n d t h e
a ct u a l fr equ en cy poin t s in vect or w in r a dia n s/secon d.
freqz ca n a ccept ot h er pa r a m et er s, su ch a s a sa m plin g fr equ en cy or a vect or of
a r bit r a r y fr equ en cy poin t s. Th e exa m ple below fin ds t h e 256-poin t fr equ en cy
r espon se for a 12t h -or der Ch ebysh ev t ype I filt er . Th e ca ll t o freqz specifies a
sa m plin g fr equ en cy Fs of 1000 H z.
[b,a] = cheby1(12,0.5,200/500);
[h,f] = freqz(b,a,256,1000);
1-24
Frequency Response
Now ca lcu la t e t h e 256-poin t com plex fr equ en cy r espon se for t h is filt er , a n d plot
t h e m a gn it u de a n d ph a se wit h a ca ll t o freqz.
freqz(b,a,256,2000)
100
Magnitude Response (dB)
-100
-200
-300
-400
0 100 200 300 400 500 600 700 800 900 1000
Frequency (Hertz)
-200
Phase (degrees)
-400
-600
-800
-1000
0 100 200 300 400 500 600 700 800 900 1000
Frequency (Hertz)
1-25
1 Signal Processing Basics
Analog Domain
freqs eva lu a t es fr equ en cy r espon se for a n a n a log filt er defin ed by t wo in pu t
coefficien t vect or s b a n d a. It s oper a t ion is sim ila r t o t h a t of freqz; you ca n
specify a n u m ber of fr equ en cy poin t s t o u se (by defa u lt , t h e fu n ct ion u ses 200),
su pply a vect or of a r bit r a r y fr equ en cy poin t s, a n d plot t h e m a gn it u de a n d
ph a se r espon se of t h e filt er .
0 200
10
100
-5
10
0
-10
10
-100
-15
10 -200
0 100 200 300 400 0 100 200 300 400
1-26
Frequency Response
200
150
100
50
-50
-100
-150
-200
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
1-27
1 Signal Processing Basics
-200
-400
-600
-800
-1000
-1200
-1400
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Delay
Th e grou p d elay of a filt er is a m ea su r e of t h e a ver a ge dela y of t h e filt er a s a
fu n ct ion of fr equ en cy. It is defin ed a s t h e n ega t ive fir st der iva t ive of a filt er ’s
ph a se r espon se. If t h e com plex fr equ en cy r espon se of a filt er is H (ejω), t h en t h e
gr ou p dela y is
d θ(ω)
τ g (ω) = – ---------------
dω
wh er e θ is t h e ph a se a n gle of H (ejω). Com pu t e gr ou p dela y wit h
[gd,w] = grpdelay(b,a,n)
θ(ω)
τ p (ω) = – -----------
ω
1-28
Frequency Response
30
Group Delay
Phase Delay
20
10
−10
−20
−30
0 200 400 600 800 1000
1-29
1 Signal Processing Basics
Zero-Pole Analysis
Th e zplane fu n ct ion plot s poles a n d zer os of a lin ea r syst em . F or exa m ple, a
sim ple filt er wit h a 0 a t -1/2 a n d a com plex pole pa ir a t 0.9 e j 2 π ( 0.3 ) a n d
0.9 e – j 2 π ( 0.3 ) is
zer = –0.5;
pol = .9*exp(j*2*pi*[–0.3 .3]');
0.8
0.6
0.4
0.2
Imaginary part
-0.2
-0.4
-0.6
-0.8
-1
-1 -0.5 0 0.5 1
Real part
1-30
Zero-Pole Analysis
See “Lin ea r Syst em Models” on pa ge 1-32 for det a ils on zer o-pole a n d t r a n sfer
fu n ct ion r epr esen t a t ion of syst em s.
1-31
1 Signal Processing Basics
• Tr a n sfer fu n ct ion
• Zer o-pole-ga in for m
• St a t e-spa ce for m
• P a r t ia l fr a ct ion expa n sion
• Secon d-or der sect ion for m
• La t t ice st r u ct u r e for m
• Con volu t ion m a t r ices
Transfer Function
Th e tran sfer fu n ction is a ba sic z-dom a in r epr esen t a t ion of a digit a l filt er ,
expr essin g t h e filt er a s a r a t io of t wo polyn om ia ls. It is t h e pr in cipa l
discr et e-t im e m odel for t h is t oolbox. Th e t r a n sfer fu n ct ion m odel descr ipt ion
for t h e z-t r a n sfor m of a digit a l filt er ’s differ en ce equ a t ion is
b (1 ) + b (2 )z – 1 + L+ b (n b + 1 )z – n b
Y (z ) = ----------------------------------------------------------------------------------------
- X (z )
a (1 ) + a (2 )z –1 + L+ a (n a + 1 )z – n a
H er e, t h e con st a n t s b(i) a n d a(i) a r e t h e filt er coefficien t s, a n d t h e or der of t h e
filt er is t h e m a xim u m of n a a n d n b. In MATLAB, you st or e t h ese coefficien t s in
t wo vect or s (r ow vect or s by con ven t ion ), on e r ow vect or for t h e n u m er a t or a n d
on e for t h e den om in a t or . See “F ilt er s a n d Tr a n sfer F u n ct ion s” on pa ge 1-15 for
m or e det a ils on t h e t r a n sfer fu n ct ion for m .
1-32
Linear System Models
Zero-Pole-Gain
Th e fa ct or ed or zero-pole-gain for m of a t r a n sfer fu n ct ion is
q(z ) ( z – q (1 ) ) ( z – q (2 ) )Lz ( – q (n ) )
H (z ) = ---------- = k -----------------------------------------------------------------------------
p (z ) ( z – p (1 ) ) ( z – p (2 ) )Lz ( – p (n ) )
By con ven t ion , MATLAB st or es polyn om ia l coefficien t s in r ow vect or s a n d
polyn om ia l r oot s in colu m n vect or s. In zer o-pole-ga in for m , t h er efor e, t h e zer o
a n d pole loca t ion s for t h e n u m er a t or a n d den om in a t or of a t r a n sfer fu n ct ion
r eside in colu m n vect or s. Th e fa ct or ed t r a n sfer fu n ct ion ga in k is a MATLAB
sca la r .
Th e poly a n d roots fu n ct ion s con ver t bet ween polyn om ia l a n d zer o-pole-ga in
r epr esen t a t ion s. F or exa m ple, a sim ple IIR filt er is
b = [2 3 4];
a = [1 3 3 1];
q =
–0.7500 + 1.1990i
–0.7500 – 1.1990i
p = roots(a)
p =
–1.0000
–1.0000 + 0.0000i
–1.0000 – 0.0000i
k = b(1)/a(1)
k =
1-33
1 Signal Processing Basics
bb =
aa = poly(p)
aa =
2 + 3 z –1 + 4 z –2 2z3 + 3z2 + 4z
H (z ) = ------------------------------------------------------
– 1 – 2 – 3
= -------------------------------------------
-
1 + 3z + 3z + z z3 + 3z2 + 3z + 1
F or b = [2 3 4], t h e roots fu n ct ion m isses t h e zer o for z equ a l t o 0. In fa ct , it
m isses poles a n d zer os for z equ a l t o 0 wh en ever t h e in pu t t r a n sfer fu n ct ion h a s
m or e poles t h a n zer os, or vice ver sa . Th is is a ccept a ble in m ost ca ses. To
cir cu m ven t t h e pr oblem , h owever , sim ply a ppen d zer os t o m a ke t h e vect or s t h e
sa m e len gt h befor e u sin g t h e roots fu n ct ion , for exa m ple, b = [b 0].
State-Space
It is a lwa ys possible t o r epr esen t a digit a l filt er , or a syst em of differ en ce
equ a t ion s, a s a set of fir st -or der differ en ce equ a t ion s. In m a t r ix or state-space
for m , you ca n wr it e t h e equ a t ion s a s
x (n + 1 ) = A x (n ) + B u (n )
y (n ) = C x (n ) + D u (n )
wh er e u is t h e in pu t , x is t h e st a t e vect or , a n d y is t h e ou t pu t . F or
sin gle-ch a n n el syst em s, A is a n m-by-m m a t r ix wh er e m is t h e or der of t h e filt er ,
B is a colu m n vect or , C is a r ow vect or , a n d D is a sca la r . St a t e-spa ce n ot a t ion is
especia lly con ven ien t for m u lt ich a n n el syst em s wh er e in pu t u a n d ou t pu t y
becom e vect or s, a n d B, C, a n d D becom e m a t r ices.
St a t e-spa ce r epr esen t a t ion ext en ds ea sily t o t h e MATLAB en vir on m en t . In
MATLAB, A, B, C, a n d D a r e r ect a n gu la r a r r a ys; MATLAB t r ea t s t h em a s
in dividu a l va r ia bles.
1-34
Linear System Models
Y (z ) = H (z )U (z ), wh er e H (z ) = C (z I – A ) – 1 B + D
Don ’t be con cer n ed if you a r e n ot fa m ilia r wit h t h e st a t e-spa ce r epr esen t a t ion
of lin ea r syst em s. Som e of t h e filt er design a lgor it h m s u se st a t e-spa ce for m
in t er n a lly bu t do n ot r equ ir e a n y kn owledge of st a t e-spa ce con cept s t o u se t h em
su ccessfu lly. If you r a pplica t ion s u se st a t e-spa ce ba sed sign a l pr ocessin g
ext en sively, h owever , con su lt t h e Con t r ol Syst em Toolbox for a com pr eh en sive
libr a r y of st a t e-spa ce t ools.
b (z ) r (1 ) r (n )
---------- = ---------------------------- - + k (1 ) + k (2 )z – 1 + L+ k (m – n + 1 )z – ( m
+ L+ ---------------------------- – n)
a (z ) 1 – p (1 )z – 1 1 – p (n )z – 1
pr ovided H (z) h a s n o r epea t ed poles. H er e, n is t h e degr ee of t h e den om in a t or
polyn om ia l of t h e r a t ion a l t r a n sfer fu n ct ion b(z)/a(z). If r is a pole of m u lt iplicit y
s r , t h en H (z) h a s t er m s of t h e for m
r (j ) r (j + 1 ) r (j + s r – 1 )
--------------------------
- + ----------------------------------
- + L+ -----------------------------------
-
1 – p (j )z – 1 ( 1 – p (j )z – 1 ) 2 ( 1 – p (j )z –1 ) s r
Th e residuez fu n ct ion in t h e Sign a l P r ocessin g Toolbox con ver t s t r a n sfer
fu n ct ion s t o a n d fr om t h e pa r t ia l fr a ct ion expa n sion for m . Th e “z” on t h e en d of
residuez st a n ds for z-dom a in , or discr et e dom a in . residuez r et u r n s t h e poles
in a colu m n vect or p, t h e r esidu es cor r espon din g t o t h e poles in a colu m n vect or
r, a n d a n y im pr oper pa r t of t h e or igin a l t r a n sfer fu n ct ion in a r ow vect or k.
residuez det er m in es t h a t t wo poles a r e t h e sa m e if t h e m a gn it u de of t h eir
differ en ce is sm a ller t h a n 0.1 per cen t of eit h er of t h e poles’ m a gn it u des.
P a r t ia l fr a ct ion expa n sion a r ises in sign a l pr ocessin g a s on e m et h od of fin din g
t h e in ver se z-t r a n sfor m of a t r a n sfer fu n ct ion . F or exa m ple, t h e pa r t ia l fr a ct ion
expa n sion of
– 4 + 8 z –1
H (z ) = ---------------------------------------
-
1 + 6 z –1 + 8 z –2
1-35
1 Signal Processing Basics
is
b = [—4 8];
a = [1 6 8];
[r,p,k] = residuez(b,a)
r =
–12
8
p =
–4
–2
k =
[]
– 12 8
H (z ) = --------------------
–
- + --------------------
1
-
1 + 4z 1 + 2 z –1
To fin d t h e in ver se z-t r a n sfor m of H (z), fin d t h e su m of t h e in ver se z-t r a n sfor m s
of t h e t wo a dden ds of H (z), givin g t h e ca u sa l im pu lse r espon se
h (n ) = – 12 ( –4 ) n + 8 ( – 2 ) n , n = 0, 1, 2, …
To ver ify t h is in MATLAB
imp = [1 0 0 0 0];
resptf = filter(b,a,imp)
resptf =
respres =
1-36
Linear System Models
L L
b 0 k + b 1 k z –1 + b 2 k z –2
H (z ) = ∏ H k (z ) = ∏ ---------------------------------------------------------
a 0 k + a 1 k z – 1 + a 2 k z –2
-
k =1 k =1
b 01 b 11 b 21 a 01 a 11 a 21
b 02 b 12 b 22 a 02 a 12 a 22
s os =
M M M M M M
b0L b1L b2L a0L a1 L a2 L
Lattice Structure
F or a discr et e N t h or der a ll-pole or a ll-zer o filt er descr ibed by t h e polyn om ia l
coefficien t s a(n ), n = 1,2,…,N +1, t h er e a r e N cor r espon din g la t t ice st r u ct u r e
coefficien t s k (n ), n = 1,2,…,N . Th e pa r a m et er s k (n ) a r e a lso ca lled t h e reflection
1-37
1 Signal Processing Basics
k(1) k(n)
z -1 Σ ... z -1 Σ
F IR La t t ice F ilt er
k(n) k(1)
Σ z -1 ... Σ z -1
f(m)
+ + + +
1-38
Linear System Models
k =
0.3090
0.9800
0.0031
0.0081
–0.0082
a =
Convolution Matrix
In sign a l pr ocessin g, con volvin g t wo vect or s or m a t r ices is equ iva len t t o
filt er in g on e of t h e in pu t oper a n ds by t h e ot h er . Th is r ela t ion sh ip per m it s t h e
r epr esen t a t ion of a digit a l filt er a s a con volu tion m atrix.
Given a n y vect or , t h e t oolbox convmtx fu n ct ion gen er a t es a m a t r ix wh ose in n er
pr odu ct wit h a n ot h er vect or is equ iva len t t o t h e con volu t ion of t h e t wo vect or s.
Th e gen er a t ed m a t r ix r epr esen t s a digit a l filt er t h a t you ca n a pply t o a n y
1-39
1 Signal Processing Basics
C =
1 0 0
2 1 0
3 2 1
0 3 2
0 0 3
1-40
Linear System Models
Y (s ) = H (s )U (s )
wh er e
H (s ) = C ( s I – A ) – 1 B + D
F or sin gle-in pu t , sin gle-ou t pu t syst em s, t h is for m is given by
b (s ) b (1 )s n b + b (2 )s n b – 1 + L+ b (n b + 1 )
H (s ) = ---------- = ---------------------------------------------------------------------------------------------
-
a (s ) a (1 )s n a + a (2 )s n a – 1 + L+ a (n a + 1 )
Given t h e coefficien t s of a La pla ce t r a n sfor m t r a n sfer fu n ct ion , residue
det er m in es t h e pa r t ia l fr a ct ion expa n sion of t h e syst em . See t h e descr ipt ion of
residue in t h e M AT L AB L an gu age R eferen ce M an u al for det a ils.
z (s ) ( s – z (1 ) ) ( s – z (2 ) )Ls ( – z (n ) )
H (s ) = ---------- = k -----------------------------------------------------------------------------
p (s ) ( s – p (1 ) ) ( s – p (2 ) )Ls ( – p (n ) )
1-41
1 Signal Processing Basics
Zero- Second-
Transfer State- pole Partial Lattice order Convolution
function space gain fraction filter sections matrix
Partial residuez
fraction residue
Convolution
matrix
1-42
Discrete Fourier Transform
X (k + 1 ) = ∑ x (n + 1 )W nk n
n =0
N –1
1
x (n + 1 ) = ---- ∑ X (k + 1 )W n– k n
N
k =0
In t h ese equ a t ion s, t h e ser ies su bscr ipt s begin wit h 1 in st ea d of 0 beca u se of
MATLAB’s vect or in dexin g sch em e, a n d
2π
–j ⎛ -------⎞
⎝ N ⎠
WN = e
NOTE MATLAB u ses a n ega t ive j for t h e fft fu n ct ion . Th is is a n en gin eer in g
con ven t ion ; ph ysics a n d pu r e m a t h em a t ics t ypica lly u se a posit ive j.
1-43
1 Signal Processing Basics
Th e DF T of t h e sign a l, a n d t h e m a gn it u de a n d ph a se of t h e t r a n sfor m ed
sequ en ce, a r e t h en
y = fft(x); % Compute DFT of x.
m = abs(y); p = unwrap(angle(y)); % mag. and phase
To plot t h e m a gn it u de a n d ph a se
f = (0:length(y)–1)*99/length(y); % frequency vector
plot(f,m)
set(gca,'XTick',[15 40 60 85]);
plot(f,p*180/pi)
set(gca,'XTick',[15 40 60 85]);
50 0
40
-500
30
20
-1000
10
0 -1500
15 40 60 85 15 40 60 85
1-44
Discrete Fourier Transform
1-45
1 Signal Processing Basics
References
Algor it h m developm en t for t h e Sign a l P r ocessin g Toolbox h a s dr a wn h ea vily
u pon t h e r efer en ces list ed below. All a r e r ecom m en ded t o t h e in t er est ed r ea der
wh o n eeds t o kn ow m or e a bou t sign a l pr ocessin g t h a n is cover ed in t h is
m a n u a l.
1 Cr och ier e, R.E ., a n d L.R. Ra bin er . M u lti-R ate S ign al Processin g. E n glewood
Cliffs, NJ : P r en t ice H a ll, 1983. P gs. 88-91.
7 P r a t t ,W.K. Digital Im age Processin g. New Yor k: J oh n Wiley & Son s, 1991.
9 P r oa kis, J .G., a n d D.G. Ma n ola kis. Digital S ign al Processin g: Prin ciples,
Algorith m s, an d Application s. Upper Sa ddle River , NJ : P r en t ice H a ll, 1996.
1-46
2
F ilt er Design
F ilte r Re qu ire m e n ts a n d S p e c ific a tio n . . . . . . . . . . . . . . . . 2-2
Re fe re n c e s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-45
2 Filter Design
2-2
Filter Requirements and Specification
Mor e r igor ou s filt er r equ ir em en t s t r a dit ion a lly in clu de pa ssba n d r ipple (Rp, in
decibels), st opba n d a t t en u a t ion (Rs, in decibels), a n d t r a n sit ion widt h (Ws–Wp,
in H er t z).
0.8
0.6
Magnitude
0.4
0.2
0 -1 0 1
10 10 10
Frequency(rad/sec)
2-3
2 Filter Design
2-4
IIR Filter Design
* See the System Identification Toolbox for an extensive collection of parametric modeling tools.
2-5
2 Filter Design
2-6
IIR Filter Design
NOTE All cla ssica l IIR lowpa ss filt er s a r e ill-con dit ion ed for ext r em ely low
cu t -off fr equ en cies. Th er efor e, in st ea d of design in g a lowpa ss IIR filt er wit h a
ver y n a r r ow pa ssba n d, it ca n be bet t er t o design a wider pa ssba n d a n d
decim a t e t h e in pu t sign a l.
Th ese a r e u sefu l in con ju n ct ion wit h t h e filt er design fu n ct ion s. Su ppose you
wa n t a ba n dpa ss filt er wit h a pa ssba n d fr om 1000 t o 2000 H z, st opba n ds
st a r t in g 500 H z a wa y on eit h er side, a 10 kH z sa m plin g fr equ en cy, a t m ost 1 dB
2-7
2 Filter Design
n =
12
Wn =
0.1951 0.4080
[b,a] = butter(n,Wn);
n =
5
Wn =
0.2000 0.4000
[b,a] = ellip(n,1,60,Wn);
Butterworth Filter
Th e Bu t t er wor t h filt er pr ovides t h e best Ta ylor Ser ies a ppr oxim a t ion t o t h e
idea l lowpa ss filt er r espon se a t Ω = 0 a n d Ω = ∞; for a n y or der N , t h e m a gn it u de
squ a r ed r espon se h a s 2N –1 zer o der iva t ives a t t h ese loca t ion s (m axim ally flat
2-8
IIR Filter Design
0.8
0.6
Magnitude
0.4
0.2
0 -1 0 1
10 10 10
Frequency(rad/sec)
0.8
0.6
Magnitude
0.4
0.2
0 -1 0 1
10 10 10
Frequency(rad/sec)
2-9
2 Filter Design
0.8
0.6
Magnitude
0.4
0.2
0 -1 0 1
10 10 10
Frequency(rad/sec)
Elliptic Filter
E llipt ic filt er s a r e equ ir ipple in bot h t h e pa ssba n d a n d st opba n d. Th ey
gen er a lly m eet filt er r equ ir em en t s wit h t h e lowest or der of a n y su ppor t ed filt er
t ype. Given a filt er or der n, pa ssba n d r ipple Rp in decibels, a n d st opba n d r ipple
2-10
IIR Filter Design
0.8
0.6
Magnitude
0.4
0.2
0 -1 0 1
10 10 10
Frequency(rad/sec)
Bessel Filter
An a log Bessel lowpa ss filt er s h a ve m a xim a lly fla t gr ou p dela y a t zer o
fr equ en cy a n d r et a in n ea r ly con st a n t gr ou p dela y a cr oss t h e en t ir e pa ssba n d.
F ilt er ed sign a ls t h er efor e m a in t a in t h eir wa vesh a pes in t h e pa ssba n d
fr equ en cy r a n ge. F r equ en cy m a pped a n d digit a l Bessel filt er s, h owever , do n ot
h a ve t h is m a xim a lly fla t pr oper t y; t h is t oolbox su ppor t s on ly t h e a n a log ca se
for t h e com plet e Bessel filt er design fu n ct ion .
2-11
2 Filter Design
Bessel filt er s gen er a lly r equ ir e a h igh er filt er or der t h a n ot h er filt er s for
sa t isfa ct or y st opba n d a t t en u a t ion . | H (jΩ)| < 1 ⁄ 2 a t Ω = 1 a n d decr ea ses a s n
in cr ea ses.
0.8
0.6
Magnitude
0.4
0.2
0 -1 0 1
10 10 10
Frequency(rad/sec)
2-12
IIR Filter Design
2-13
2 Filter Design
1.2
0.8
0.6
0.4
0.2
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
2-14
IIR Filter Design
b =
0.0317 0.0951 0.0951 0.0317
a =
1.0000 –1.4590 0.9104 -0.1978
[b,a] = butter(3,0.25)
b =
0.0317 0.0951 0.0951 0.0317
a =
1.0000 –1.4590 0.9104 -0.1978
b =
0.0950 0.2849 0.2849 0.0950
a =
1.0000 -0.2402
ans =
0.0331 0.2500 0.4337 0.2500 0.0331
F or com plet e det a ils of t h e maxflat a lgor it h m , see Selesn ick a n d Bu r r u s [2].
2-15
2 Filter Design
2-16
FIR Filter Design
Linear
Phase Filter Response H(f), Response H(f),
Filter Type Order n Symmetry of Coefficients f=0 f = 1 (Nyquist)
2-17
2 Filter Design
Windowing Method
Con sider t h e idea l, or “br ick-wa ll,” digit a l lowpa ss filt er wit h a cu t off fr equ en cy
of ω0 r a d/sec. Th is filt er h a s m a gn it u de 1 a t a ll fr equ en cies wit h m a gn it u de less
t h a n ω0 , a n d m a gn it u de 0 a t fr equ en cies wit h m a gn it u de bet ween ω0 a n d π. It s
im pu lse r espon se sequ en ce h (n ) is
π ω0 ω0 ω0
1 1
h (n ) = ------
2π ∫–π H (ω)e j ωn d ω = ------
2π ∫–ω e j ωn d ω
0
= ------- sin c(------- n )
π π
2-18
FIR Filter Design
0.8
Magnitude Response
0.6
0.4
0.2
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency (Nyquist == 1)
2-19
2 Filter Design
0.8
Magnitude Response
0.6
0.4
0.2
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency (Nyquist == 1)
2-20
FIR Filter Design
Th e st a t em en t s
n = 50;
Wn = 0.4;
b = fir1(n,Wn);
2-21
2 Filter Design
Basic Configurations
Th e defa u lt m ode of oper a t ion of firls a n d remez is t o design t ype I or t ype II
lin ea r ph a se filt er s, depen din g on wh et h er t h e or der you desir e is even or odd,
r espect ively. A lowpa ss exa m ple wit h a ppr oxim a t e a m plit u de 1 fr om 0 t o 0.4
H z, a n d a ppr oxim a t e a m plit u de 0 fr om 0.5 t o 1.0 H z is
n = 20; % filter order
f = [0 .4 .5 1]; % frequency band edges
a = [1 1 0 0]; % desired amplitudes
b = remez(n,f,a);
2-22
FIR Filter Design
0.8
0.6
Magnitude
0.4
0.2
0 -1 0 1
10 10 10
Frequency(rad/sec)
You ca n see t h a t t h e filt er design ed wit h remez exh ibit s equ ir ipple beh a vior .
Also n ot e t h a t t h e firls filt er h a s a bet t er r espon se over m ost of t h e pa ssba n d
a n d st opba n d, bu t a t t h e ba n d edges (f = 0.4 a n d f = 0.5), t h e r espon se is
fu r t h er a wa y fr om t h e idea l t h a n t h e remez filt er . Th is sh ows t h a t t h e remez
filt er ’s m axim u m er r or over t h e pa ss- a n d st opba n ds is sm a ller a n d, in fa ct , it
is t h e sm a llest possible for t h is ba n d edge con figu r a t ion a n d filt er len gt h .
Th in k of fr equ en cy ba n ds a s lin es over sh or t fr equ en cy in t er va ls. remez a n d
firls u se t h is sch em e t o r epr esen t a n y piecewise lin ea r desir ed fu n ct ion wit h
2-23
2 Filter Design
a n y t r a n sit ion ba n ds. firls a n d remez design lowpa ss, h igh pa ss, ba n dpa ss,
a n d ba n dst op filt er s; a ba n dpa ss exa m ple is
f = [0 0.3 0.4 0.7 0.8 1]; % band edges in pairs
a = [0 0 1 1 0 0]; % bandpass filter amplitude
2-24
FIR Filter Design
1 1
0.8 0.8
0.6 0.6
0.4 0.4
0.2 0.2
0 0
0 0.25 0.5 0.75 1 0 0.25 0.5 0.75 1
Frequency (Normalized) Frequency (Normalized)
2-25
2 Filter Design
Th is m et h od does n ot wor k dir ect ly for filt er s of odd or der , wh ich r equ ir e a
n on in t eger dela y. In t h is ca se, t h e hilbert fu n ct ion , descr ibed in t h e
“Specia lized Tr a n sfor m s” sect ion in Ch a pt er 4, est im a t es t h e a n a lyt ic sign a l.
Alt er n a t ively, u se t h e resample fu n ct ion t o dela y t h e sign a l by a n on in t eger
n u m ber of sa m ples.
Differentiators
Differ en t ia t ion of a sign a l in t h e t im e dom a in is equ iva len t t o m u lt iplica t ion of
t h e sign a l’s F ou r ier t r a n sfor m by a n im a gin a r y r a m p fu n ct ion . Th a t is, t o
differ en t ia t e a sign a l, pa ss it t h r ou gh a filt er t h a t h a s a r espon se H (w ) = jw .
Appr oxim a t e t h e idea l differ en t ia t or (wit h a dela y) u sin g remez or firls wit h
a 'd' or 'differentiator' opt ion .
b = remez(21,[0 1],[0 pi*Fs],'d');
2-26
FIR Filter Design
3500 3500
3000 3000
2500 2500
2000 2000
1500 1500
1000 1000
500 500
0 0
0 100 200 300 400 500 0 100 200 300 400 500
Frequency (Normalized) Frequency (Normalized)
2-27
2 Filter Design
Description Function
F or det a ils on t h e ca llin g syn t a x for t h ese fu n ct ion s, see t h eir r efer en ce
descr ipt ion s in Ch a pt er 6.
dp = 0.02
ds = 0.008
1 0
2-28
FIR Filter Design
0.8
0.6
0.4
0.2
-0.2
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
2-29
2 Filter Design
Design a CLS filt er wit h im pu lse r espon se or der 129 t h a t m eet s t h ese
specifica t ion s.
n = 129;
f = [0 0.3 0.5 0.7 0.9 1];
a = [0 0.5 0 1 0];
up = [0.005 0.51 0.03 1.02 0.05];
lo = [–0.005 0.49 –0.03 0.98 –0.05];
h = fircls(n,f,a,up,lo,'plot');
1.2
0.8
0.6
0.4
0.2
-0.2
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
2-30
FIR Filter Design
0.8
0.6
0.4
0.2
-0.2
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
2-31
2 Filter Design
[-1 -0.5] [5 1] 1
[-0.4 +0.3] [2 2] 10
[+0.4 +0.8] [2 1] 5
2-32
FIR Filter Design
4.5
4
Magnitude Response
3.5
2.5
1.5
1
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
Normalized Frequency
2-33
2 Filter Design
1.5
Real Part
0.5
-0.5
0 5 10 15 20 25 30 35 40
0.2
Imag Part
-0.2
0 5 10 15 20 25 30 35 40
2-34
FIR Filter Design
Th e r esu lt in g m a gn it u de r espon se is
[h,w] = freqz(b,1,512,'whole');
plot(w/pi–1,fftshift(abs(h)));
1.4
1.2
1
Magnitude Response
0.8
0.6
0.4
0.2
0
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
Normalized Frequency
17
16
Group delay (in samples)
15
14
13
12
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5
Normalized frequency (Nyquist == 1)
2-35
2 Filter Design
2-36
Special Topics in IIR Filter Design
Complete Design
butter cheby1 cheby2 ellip besself
2-37
2 Filter Design
Frequency Transformation
Th e secon d st ep in t h e a n a log pr ot ot ypin g design t ech n iqu e is t h e fr equ en cy
t r a n sfor m a t ion of a lowpa ss pr ot ot ype. Th e t oolbox pr ovides a set of fu n ct ion s
t o t r a n sfor m a n a log lowpa ss pr ot ot ypes (wit h cu t off fr equ en cy of 1 r a d/sec) in t o
ba n dpa ss, h igh pa ss, ba n dst op, a n d lowpa ss filt er s of t h e desir ed cu t off
fr equ en cy.
2-38
Special Topics in IIR Filter Design
ω0
s' = -------
s
ω0 = ω 1 ω2
and
B ω = ω2 – ω1
2-39
2 Filter Design
2-40
Special Topics in IIR Filter Design
0
10
-1
10
-2
10
-3
10
-4
10
-5
10
-6
10
-7
10
pi/5 pi
Frequency (rad/sec)
Filter Discretization
Th e t h ir d st ep in t h e a n a log pr ot ot ypin g t ech n iqu e is t h e t r a n sfor m a t ion of t h e
filt er t o t h e discr et e-t im e dom a in . Th e t oolbox pr ovides t wo m et h ods for t h is:
t h e im pu lse in va r ia n t a n d bilin ea r t r a n sfor m a t ion s. Th e filt er design fu n ct ion s
2-41
2 Filter Design
Impulse Invariance
Th e t oolbox fu n ct ion impinvar cr ea t es a digit a l filt er wh ose im pu lse r espon se
is t h e sa m ples of t h e con t in u ou s im pu lse r espon se of a n a n a log filt er . Th is
fu n ct ion wor ks on ly on filt er s in t r a n sfer fu n ct ion for m . F or best r esu lt s, t h e
a n a log filt er sh ou ld h a ve n egligible fr equ en cy con t en t a bove h a lf t h e sa m plin g
fr equ en cy, beca u se su ch h igh fr equ en cy con t en t is a lia sed in t o lower ba n ds
u pon sa m plin g. Im pu lse in va r ia n ce wor ks for som e lowpa ss a n d ba n dpa ss
filt er s, bu t is n ot a ppr opr ia t e for h igh pa ss a n d ba n dst op filt er s.
2-42
Special Topics in IIR Filter Design
0
Magnitude Response (dB)
-50
-100
-150
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized frequency (Nyquist == 1)
200
0
Phase (degrees)
-200
-400
-600
-800
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized frequency (Nyquist == 1)
Bilinear Transformation
Th e bilin ea r t r a n sfor m a t ion is a n on lin ea r m a ppin g of t h e con t in u ou s dom a in
t o t h e discr et e dom a in ; it m a ps t h e s-pla n e in t o t h e z-pla n e by
H (z ) = H (s ) z–1
s = k ------------
z+1
Ω
ω = 2 t a n – 1 ⎛ ----⎞
⎝ k ⎠
2-43
2 Filter Design
0
Magnitude Response (dB)
-100
-200
-300
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized frequency (Nyquist == 1)
500
Phase (degrees)
-500
-1000
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized frequency (Nyquist == 1)
2-44
Special Topics in IIR Filter Design
A digit a l ba n dpa ss filt er wit h cor r ect ba n d edges 0.1 a n d 0.5 t im es t h e Nyqu ist
fr equ en cy is
[Ad,Bd,Cd,Dd] = bilinear(At,Bt,Ct,Dt,Fs);
2-45
2 Filter Design
References
1 Ka r a m , L.J ., a n d J .H . McClella n . “Com plex Ch ebysh ev Appr oxim a t ion for
F IR F ilt er Design .” IE E E T ran s. on Circu its an d S ystem s II. Ma r ch 1995.
2-46
3
St a t ist ica l Sign a l
P r ocessin g
Co rre la tio n a n d Co v a ria n c e . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2
Bia s a n d Nor m a liza t ion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-3
Mu lt iple Ch a n n els . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-4
S p e c tra l An a ly s is . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-5
Welch ’s Met h od . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6
Mu lt it a per Met h od . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-16
Yu le-Wa lker AR Met h od . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-19
Bu r g Met h od . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-20
Cova r ia n ce a n d Modified Cova r ia n ce Met h ods . . . . . . . . . . . . . 3-22
MUSIC a n d E igen vect or An a lysis Met h ods . . . . . . . . . . . . . . . 3-23
Re fe re n c e s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-27
3 Statistical Signal Processing
γ x y (m ) = E {x n y * n +m}
C x y (m ) = E {( x n – µ x ) ( y * n + m – µ * x )}
C x y (m ) = γ x y (m ) – µ x µ * y
N – m –1
⎧
⎪ x n y n* + m
⎪ ∑ m ≥0
R̂ x y (m ) = ⎨
n =0
⎪
⎪ *
⎩ R̂ y x (– m ) m <0
3-2
Correlation and Covariance
xyc =
1.0000
2.0000
3.0000
4.0000
5.0000
4.0000
3.0000
2.0000
1.0000
E {R̂ x y (m )} = ∑ E {x n y * n + m } = ( N – m )γ x y (m )
n =0
3-3
3 Statistical Signal Processing
Multiple Channels
F or a m u lt ich a n n el sign a l, xcorr a n d xcov est im a t e t h e a u t ocor r ela t ion a n d
cr oss-cor r ela t ion a n d cova r ia n ce sequ en ces for a ll of t h e ch a n n els a t on ce. If S
is a n M -by-N sign a l m a t r ix r epr esen t in g N ch a n n els in it s colu m n s, xcorr(S)
r et u r n s a (2M -1)-by-N 2 m a t r ix wit h t h e a u t ocor r ela t ion s a n d cr oss-cor r ela t ion s
of t h e ch a n n els of S in it s N 2 colu m n s. If S is a 3-ch a n n el sign a l
S = [s1 s2 s3]
3-4
Spectral Analysis
Spectral Analysis
Spect r a l a n a lysis seeks t o descr ibe t h e fr equ en cy con t en t of a sign a l, r a n dom
pr ocess, or syst em , ba sed on a fin it e set of da t a . E st im a t ion of power spect r a is
u sefu l in a va r iet y of a pplica t ion s, in clu din g t h e det ect ion of sign a ls bu r ied in
wide-ba n d n oise.
Th e pow er spectral d en sity (P SD) of a st a t ion a r y r a n dom pr ocess x n is r ela t ed
m a t h em a t ica lly t o t h e cor r ela t ion sequ en ce by t h e discr et e-t im e F ou r ier
t r a n sfor m ,
∞
P x x ( ω) = ∑ γ x x (m )e –j ωm
m = –∞
P x y ( ω) = ∑ γ x y (m )e –j ωm
m = –∞
3-5
3 Statistical Signal Processing
Welch’s Method
On e wa y of est im a t in g t h e power spect r u m of a pr ocess is t o sim ply fin d t h e
discr et e-t im e F ou r ier t r a n sfor m of t h e sa m ples of t h e pr ocess (u su a lly don e on
3-6
Spectral Analysis
A cr u de est im a t e of t h e P SD of xn is
Pxx = abs(fft(xn,1024)).^2/1001;
20
Power Spectrum (dB)
15
10
-5
-10
0 100 200 300 400 500 600 700 800 900 1000
Frequency (Hz)
3-7
3 Statistical Signal Processing
Short Periodogram
30
Power Spectrum (dB)
20
10
-10
-20
0 100 200 300 400 500 600 700 800 900 1000
Frequency (Hz)
Periodogram
30
20
Power Spectrum (dB)
10
-10
-20
-30
0 100 200 300 400 500 600 700 800 900 1000
Frequency (Hz)
3-8
Spectral Analysis
20
Power Spectrum (dB)
15
10
-5
-10
0 100 200 300 400 500 600 700 800 900 1000
Frequency (Hz)
3-9
3 Statistical Signal Processing
20
Power Spectrum (dB)
15
10
-5
-10
0 100 200 300 400 500 600 700 800 900 1000
Frequency (Hz)
3-10
Spectral Analysis
Pxx is sca led by t h e r ecipr oca l of t h e sa m plin g fr equ en cy, 1/Fs. pwelch wit h ou t
a n y ou t pu t s gen er a t es a plot of t h e P SD over t h e fr equ en cy r a n ge [0,Fs/2):
pwelch(xn,nfft,Fs,window,noverlap)
Welch’s Spectral Estimate Pxx(f) / fs
−5
−10
Power Spectral Density (dB)
−15
−20
−25
−30
−35
−40
0 50 100 150 200 250 300 350 400 450 500
Frequency (Hz)
All t h e spect r a l est im a t ion fu n ct ion s a llow you t o specify a n em pt y m a t r ix, [],
in pla ce of a n in pu t a r gu m en t t o u se t h e defa u lt va lu e of t h a t a r gu m en t . In t h e
com m a n d a bove, beca u se t h e va lu es for nfft a n d window a r e a ct u a lly t h e sa m e
a s t h e defa u lt s, you cou ld r epla ce t h em bot h wit h t h e em pt y m a t r ix.
[Pxx,f] = pwelch(xn,[],Fs,[],noverlap);
3-11
3 Statistical Signal Processing
1 π
E { P̂ x x (ω) } = ------------------2-
2π w ∫–π P x x(θ) W (ω – θ) d θ
Beca u se t h e expect ed va lu e is n ot equ a l t o t h e t r u e P SD, t h e est im a t e is biased .
Th is qu a n t it y is t h e con volu t ion of t h e t r u e P SD wit h t h e squ a r ed m a gn it u de
of t h e win dow’s discr et e-t im e F ou r ier t r a n sfor m W(ω), sca led by t h e squ a r ed
n or m of t h e win dow. Th e sca lin g fa ct or is t h e su m of t h e squ a r es of t h e win dow
fu n ct ion :
2
w = ∑ w (n ) 2
Th is sa ys t h a t if P xx (ω) h a s a pea k of h eigh t 1 a t a pa r t icu la r fr equ en cy ω0 , t h e
est im a t e will h a ve a ppr oxim a t e h eigh t W (0 ) 2 ⁄ w 2 a t t h a t fr equ en cy,
pr ovided t h e win dow W(ω) is n a r r ow wit h r espect t o t h e spa cin g bet ween t h e
pea k a n d ot h er spect r a l fea t u r es. So, t o obt a in a n est im a t e wh ich on a ver a ge
r eflect s t h e h eigh t of t h e or igin a l pea ks, m u lt iply t h e r esu lt of pwelch by
3-12
Spectral Analysis
−20
−30
−40
−50
−60
−70
0 100 200 300 400 500
−20
−30
−40
−50
−60
−70
0 100 200 300 400 500
3-13
3 Statistical Signal Processing
Confidence Intervals
Bot h t h e pwelch a n d csd fu n ct ion s ca n com pu t e con fiden ce in t er va ls. Sim ply
pr ovide a n in pu t a r gu m en t p, wh ich specifies t h e per cen t a ge of t h e con fiden ce
in t er va l.
[Pxx,Pxxc,f] = pwelch(x,nfft,Fs,window,noverlap,p)
[Pxy,Pxyc,f] = csd(x,y,nfft,Fs,window,noverlap,p)
P̂ x y (ω)
Ĥ (ω) = -----------------
P̂ x x (ω)
3-14
Spectral Analysis
0.8
0.6
0.4
0.2
0
0 100 200 300 400 500
0.8
0.6
0.4
0.2
0
0 100 200 300 400 500
Frequency (Hz)
Coherence Function
Th e m a gn it u de-squ a r ed coh er en ce bet ween t wo sign a ls x(n ) a n d y(n ) is
P x y ( ω) 2
C x y (ω) = -----------------------------------
P x x (ω)P y y (ω)
3-15
3 Statistical Signal Processing
Coherence Function
1
Coherence Function Estimate
0.8
0.6
0.4
0.2
0
0 50 100 150 200 250 300 350 400 450 500
Frequency
Multitaper Method
Th e m u ltitaper m eth od (MTM) u ses or t h ogon a l win dows (or “t a per s”) t o obt a in
a ppr oxim a t ely in depen den t est im a t es of t h e power spect r u m a n d t h en
com bin es t h em t o yield a n est im a t e. Th is est im a t e exh ibit s m or e degr ees of
fr eedom a n d a llows for ea sier qu a n t ifica t ion of t h e bia s a n d va r ia n ce t r a de-offs,
com pa r ed t o con ven t ion a l per iodogr a m m et h ods. Ma n y con ven t ion a l spect r a l
est im a t es u se a sin gle t a per (or “win dow”), wit h som e ir r et r ieva ble loss of
in for m a t ion a t t h e begin n in g a n d t h e en d of t h e ser ies. In t h e m u lt it a per
m et h od, a ddit ion a l t a per s a r e u sed t o r ecover som e of t h e lost in for m a t ion .
Th is br ief discu ssion of t h e m u lt it a per m et h od pr ovides a n in t u it ive look a t t h e
a lgor it h m t o a ssist in det er m in in g wh en t o u se it . F or a m or e det a iled a n d
t h or ou gh expla n a t ion , see P er civa l a n d Wa lden [3].
Th e sim ple pa r a m et er for t h e m u lt it a per m et h od is t h e t im e-ba n dwidt h
pr odu ct , N W. Th is pa r a m et er is a “r esolu t ion ” pa r a m et er dir ect ly r ela t ed t o t h e
n u m ber of t a per s u sed t o com pu t e t h e spect r u m . Th er e a r e a lwa ys 2 *N W-1
t a per s u sed t o for m t h e est im a t e. Th is m ea n s t h a t , a s N W in cr ea ses, t h er e a r e
3-16
Spectral Analysis
[P,f] = pmtm(xn,4,1024,Fs);
plot(f,10*log10(P)) % plot in decibels
axis([30 150 –20 30])
30
25
20
15
Magnitude (dB)
10
-5
-10
-15
-20
40 60 80 100 120 140
Frequency (Hz)
3-17
3 Statistical Signal Processing
30
25
20
15
Magnitude (dB)
10
-5
-10
-15
-20
40 60 80 100 120 140
Frequency (Hz)
350
300
250
Magnitude
200
150
100
50
0
40 60 80 100 120 140
Frequency (Hz)
3-18
Spectral Analysis
ans =
1.8447e+03
sum(P1)
ans =
1.8699e+03
Yule-Walker AR Method
Th e Y u le-Walk er A R m eth od is a n a u t or egr essive t ech n iqu e for spect r a l den sit y
est im a t ion (see Ma r ple [2], Ch a pt er 7, a n d P r oa kis[4], Sect ion 12.3.2). Th is
m et h od solves for t h e AR m odel pa r a m et er s by t h e a u t ocor r ela t ion m et h od.
Th e Yu le-Wa lker AR est im a t e is obt a in ed by solu t ion of t h e n or m a l equ a t ion s.
* *
r (1 ) r (2 ) L r (n ) a (2 ) – r (2 )
* a (3 ) – r (3 )
r (2 ) r (1 ) L r (n – 1 ) =
M O O M M M
r (n ) L r (2 ) r (1 ) a (n + 1 ) – r (n + 1 )
3-19
3 Statistical Signal Processing
1
P YuleAR(f ) = ----------------------
-
a e (f ) 2
H
−20
Welch
Yule–Walker AR
−30
−40
Magnitude (dB)
−50
−60
−70
−80
−90
0 500 1000 1500 2000 2500 3000 3500 4000
Frequency (Hz)
Burg Method
Th e Bu r g m et h od for AR spect r a l est im a t ion is ba sed on m in im izin g t h e
for wa r d a n d ba ckwa r d pr edict ion er r or s wh ile sa t isfyin g t h e Levin son -Du r bin
r ecu r sion (see Ma r ple[2], Ch a pt er 7, a n d P r oa kis[4], Sect ion 12.3.3). In
con t r a st t o ot h er AR est im a t ion m et h ods, t h e Bu r g m et h od a voids ca lcu la t in g
3-20
Spectral Analysis
−20
Burg
Yule–Walker AR
−30
−40
Magnitude (dB)
−50
−60
−70
−80
−90
0 500 1000 1500 2000 2500 3000 3500 4000
Frequency (Hz)
3-21
3 Statistical Signal Processing
−10
−15
Magnitude (dB)
−20
−25
−30
−35
−40
−45
−50
0 50 100 150 200
Frequency (Hz)
3-22
Spectral Analysis
−40
Covariance
Modified Covariance
−50
−60
Magnitude (dB)
−70
−80
−90
−100
0 500 1000 1500 2000 2500 3000 3500 4000
Frequency (Hz)
3-23
3 Statistical Signal Processing
Eigenanalysis Overview
Con sider a n u m ber of com plex sin u soids em bedded in wh it e n oise. You ca n
wr it e t h e a u t ocor r ela t ion m a t r ix R for t h is syst em a s t h e su m of t h e sign a l
a u t ocor r ela t ion m a t r ix (S ) a n d t h e n oise a u t ocor r ela t ion m a t r ix (W).
R = S +W
Th er e is a close r ela t ion sh ip bet ween t h e eigen vect or s of t h e sign a l
a u t ocor r ela t ion m a t r ix a n d t h e sign a l a n d n oise su bspa ces. Th e eigen vect or s v
of S spa n t h e sa m e sign a l su bspa ce a s t h e sign a l vect or s. If t h e syst em con t a in s
M com plex sin u soids a n d t h e or der of t h e a u t ocor r ela t ion m a t r ix is p,
eigen vect or s v M +1 t h r ou gh v p+1 spa n t h e n oise su bspa ce of t h e a u t ocor r ela t ion
m a t r ix.
1 1
P music(f ) = ---------------------------------------------------------------
N
- = ------------------------------------------
N -
⎛ ⎞
e H (f ) ⎜ ∑ v k v kH ⎟ e (f ) ∑ v kH e (f ) 2
⎜ ⎟
⎝ k = p + 1 ⎠ k =p+1
3-24
Spectral Analysis
1
P ev (f ) = ----------------------------------------------------------
N
-
⎛ ⎞
⎜ v kH e (f ) 2⎟ ⁄ λ k
⎜ ∑ ⎟
⎝ k = p + 1 ⎠
3-25
3 Statistical Signal Processing
3-26
References
References
1 Ka y, S.M. M od ern S pectral E stim ation . E n glewood Cliffs, NJ : P r en t ice H a ll,
1988.
4 P r oa kis, J .G., a n d D.G. Ma n ola kis. Digital S ign al Processin g: Prin ciples,
Algorith m s, an d Application s. E n glewood Cliffs, NJ : P r en t ice H a ll, 1996.
3-27
3 Statistical Signal Processing
3-28
4
Specia l Topics
Win d o w s . . . . . . . . . . . . . . . . . ... ... ... .... ... ... ... .... . 4-2
Ba sic Sh a pes . . . . . . . . . . . . . . ... ... ... .... ... ... ... .... . 4-2
Gen er a lized Cosin e Win dows . ... ... ... .... ... ... ... .... . 4-4
Ka iser Win dow . . . . . . . . . . . . ... ... ... .... ... ... ... .... . 4-4
Ch ebysh ev Win dow . . . . . . . . . ... ... ... .... ... ... ... .... . 4-9
Re s a m p lin g . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-20
Ce p s tru m An a ly s is . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-23
In ver se Com plex Cepst r u m . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-25
D e c o n v o lu t io n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-33
S p e c ia lize d Tra n s fo rm s ... ... ... ... .... ... ... ... .... 4-34
Ch ir p z-Tr a n sfor m . . . . . . ... ... ... ... .... ... ... ... .... 4-34
Discr et e Cosin e Tr a n sfor m ... ... ... ... .... ... ... ... .... 4-36
H ilber t Tr a n sfor m . . . . . . . ... ... ... ... .... ... ... ... .... 4-38
Re fe re n c e s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-40
4 Special Topics
Windows
In bot h digit a l filt er design a n d power spect r u m est im a t ion , t h e ch oice of a
win dowin g fu n ct ion ca n pla y a n im por t a n t r ole in det er m in in g t h e qu a lit y of
over a ll r esu lt s. Th e m a in r ole of t h e win dow is t o da m p ou t t h e effect s of t h e
Gibbs ph en om en on t h a t r esu lt s fr om t r u n ca t ion of a n in fin it e ser ies.
Th e t oolbox win dow fu n ct ion s a r e sh own in t h e t a ble below.
Window Function
Basic Shapes
Th e ba sic win dow is t h e rectan gu lar w in d ow , a vect or of on es of t h e a ppr opr ia t e
len gt h . A r ect a n gu la r win dow of len gt h 50 is
n = 50;
w = boxcar(n);
Th is t oolbox st or es win dows in colu m n vect or s by con ven t ion , so a n equ iva len t
expr ession is
w = ones(50,1);
4-2
Windows
ans =
0
0.3333
0.6667
1.0000
0.6667
0.3333
0
triang(5)
ans =
0.3333
0.6667
1.0000
0.6667
0.3333
ans =
0.2857 0.1667
0.5714 0.5000
0.8571 0.8333
0.8571 0.8333
0.5714 0.5000
0.2857 0.1667
4-3
4 Special Topics
win dow is n ega t ive for n even . Th e F ou r ier t r a n sfor m of a t r ia n gu la r win dow,
h owever , is a lwa ys n on n ega t ive.
Th is differ en ce ca n be im por t a n t wh en ch oosin g a win dow for som e spect r a l
est im a t ion t ech n iqu es, su ch a s t h e Bla ck m a n -Tu key m et h od. Bla ckm a n -Tu k ey
for m s t h e spect r a l est im a t e by ca lcu la t in g t h e F ou r ier t r a n sfor m of t h e
a u t ocor r ela t ion sequ en ce. Th e r esu lt in g est im a t e m igh t be n ega t ive a t som e
fr equ en cies if t h e win dow’s F ou r ier t r a n sfor m is n ega t ive (see Ka y [1], pg. 80).
Kaiser Window
Th e Kaiser w in d ow is a n a ppr oxim a t ion t o t h e pr ola t e-sph er oida l win dow, for
wh ich t h e r a t io of t h e m a in lobe en er gy t o t h e sidelobe en er gy is m a xim ized. F or
a Ka iser win dow of a pa r t icu la r len gt h , t h e pa r a m et er β con t r ols t h e sidelobe
h eigh t . F or a given β, t h e sidelobe h eigh t is fixed wit h r espect t o win dow len gt h .
4-4
Windows
-20
-40
Normalized Magnitude (dB)
-60
-80
-100
-120
-140
beta = 1
beta = 2
-160 beta = 3
-180
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency (Nyquist == 1)
4-5
4 Special Topics
-40
-60
-80
-100
-120
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency (Nyquist == 1)
4-6
Windows
α–8
n = ----------------------- + 1
2.285 Δω
F ilt er s design ed u sin g t h ese h eu r ist ics will m eet t h e specifica t ion s
a ppr oxim a t ely, bu t you sh ou ld ver ify t h is. To design a lowpa ss filt er wit h cu t off
fr equ en cy 0.5π r a d/sec, t r a n sit ion widt h 0.2π r a d/sec, a n d 40 dB of a t t en u a t ion
in t h e st opba n d, t r y
[n,wn,beta] = kaiserord([0.4 0.6]*pi,[1 0],[0.01 0.01],2*pi);
h = fir1(n,wn,kaiser(n+1,beta),'noscale');
4-7
4 Special Topics
0.2
-20
40 dB
Magnitude (dB)
-40
-60
-80
-100
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency (Nyquist == 1)
4-8
Windows
Chebyshev Window
Th e Ch ebysh ev win dow m in im izes t h e m a in lobe widt h , given a pa r t icu la r
sidelobe h eigh t . It is ch a r a ct er ized by a n equ ir ipple beh a vior , t h a t is, it s
sidelobes a ll h a ve t h e sa m e h eigh t . Th e chebwin fu n ct ion , wit h len gt h a n d
sidelobe h eigh t pa r a m et er s, com pu t es a Ch ebysh ev win dow.
n = 51;
Rs = 40; % sidelobe height in decibels
w = chebwin(n,Rs);
stem(w)
Length 51 Chebyshev Window
1
0.8
0.6
0.4
0.2
0
0 5 10 15 20 25 30 35 40 45 50
Sample Number
-20
-40
-60
-80
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency (Nyquist == 1)
4-9
4 Special Topics
Parametric Modeling
P a r a m et r ic m odelin g t ech n iqu es fin d t h e pa r a m et er s for a m a t h em a t ica l m odel
descr ibin g a sign a l, syst em , or pr ocess. Th ese t ech n iqu es u se kn own
in for m a t ion a bou t t h e syst em t o det er m in e t h e m odel. Applica t ion s for
pa r a m et r ic m odelin g in clu de speech a n d m u sic syn t h esis, da t a com pr ession ,
h igh -r esolu t ion spect r a l est im a t ion , com m u n ica t ion s, m a n u fa ct u r in g, a n d
sim u la t ion .
Th e t oolbox pa r a m et r ic m odelin g fu n ct ion s oper a t e wit h t h e r a t ion a l t r a n sfer
fu n ct ion m odel. Given a ppr opr ia t e in for m a t ion a bou t a n u n kn own syst em
(im pu lse or fr equ en cy r espon se da t a , or in pu t a n d ou t pu t sequ en ces), t h ese
fu n ct ion s fin d t h e coefficien t s of a lin ea r syst em t h a t m odels t h e syst em .
On e im por t a n t a pplica t ion of t h e pa r a m et r ic m odelin g fu n ct ion s is in t h e
design of filt er s t h a t h a ve a pr escr ibed t im e or fr equ en cy r espon se. Th ese
fu n ct ion s pr ovide a da t a -or ien t ed a lt er n a t ive t o t h e IIR a n d F IR filt er design
fu n ct ion s discu ssed in Ch a pt er 2.
H er e is a su m m a r y of t h e pa r a m et r ic m odelin g fu n ct ion s in t h is t oolbox. Not e
t h a t t h e Syst em Iden t ifica t ion Toolbox pr ovides a m or e ext en sive collect ion of
pa r a m et r ic m odelin g fu n ct ion s.
4-10
Parametric Modeling
4-11
4 Special Topics
Linear Prediction
Lin ea r pr edict ion m odelin g a ssu m es t h a t ea ch ou t pu t sa m ple of a sign a l, x(k),
is a lin ea r com bin a t ion of t h e pa st n ou t pu t s (t h a t is, it ca n be “lin ea r ly
pr edict ed” fr om t h ese ou t pu t s), a n d t h a t t h e coefficien t s a r e con st a n t fr om
sa m ple t o sa m ple.
x (k ) = – a (2 )x (k – 1 ) – a (3 )x (k – 2 ) – L– a (n + 1 )x (k – n )
An nt h -or der a ll-pole m odel of a sign a l x is
a = lpc(x,n)
a =
1.0000 0.0395 0.0338 0.0668 0.1264
lpc fir st ca lls xcorr t o fin d a bia sed est im a t e of t h e cor r ela t ion fu n ct ion of x,
a n d t h en u ses t h e Levin son -Du r bin r ecu r sion , im plem en t ed in t h e levinson
fu n ct ion , t o fin d t h e m odel coefficien t s a. Th e Levin son -Du r bin r ecu r sion is a
fa st a lgor it h m for solvin g a syst em of sym m et r ic Toeplit z lin ea r equ a t ion s.
lpc’s en t ir e a lgor it h m for n = 4 is
r = xcorr(x);
r(1:length(x)–1) = []; % remove corr. at negative lags
a = levinson(r,4)
a =
1.0000 0.0395 0.0338 0.0668 0.1264
4-12
Parametric Modeling
You cou ld for m t h e lin ea r pr edict ion coefficien t s wit h ot h er a ssu m pt ion s by
pa ssin g a differ en t cor r ela t ion est im a t e t o levinson, su ch a s t h e u n bia sed
cor r ela t ion est im a t e.
r = xcorr(x,'unbiased');
r(1:length(x)–1) = []; % remove corr. at negative lags
a = levinson(r,4)
a =
1.0000 0.0554 0.0462 0.0974 0.2115
4-13
4 Special Topics
A m odel for t h e t est sequ en ce x (fr om t h e ea r lier lpc exa m ple) u sin g a
t h ir d-or der IIR filt er is
[b,a] = prony(x,3,3)
b =
1.1165 –0.2181 –0.6084 0.5369
a =
1.0000 –0.1619 –0.4765 0.4940
ans =
1.11649535105007 1.11649535105007
–0.03731609173676 –0.03731609173676
–0.08249198453223 –0.08249198453223
–0.04583930972315 –0.04583930972315
–0.14255125351637 –0.02829072973977
0.20400424807471 0.01433198229497
0.02685697779814 0.01148698991026
0.18956307836948 0.02266475846451
0.02717716288172 0.00206242734272
0.08057060786906 0.00545783754743
Not ice t h a t t h e fir st fou r sa m ples m a t ch exa ct ly. F or a n exa m ple of exa ct
r ecover y, r ecover t h e coefficien t s of a Bu t t er wor t h filt er fr om it s im pu lse
r espon se.
[b,a] = butter(4,.2);
h = impz(b,a,26);
[bb,aa] = prony(h,4,4);
4-14
Parametric Modeling
b =
1.1165 –0.6213 –0.8365 1.3331
a =
1.0000 –0.5401 –0.6109 1.1298
b =
1
a =
1 1
4-15
4 Special Topics
ans =
0.1165 0 0
–0.0058 0 –0.0190
–0.0535 0.0000 0.0818
0.0151 –0.0000 –0.0176
–0.1473 –0.1143 –0.0476
0.2005 0.1897 0.0869
0.0233 0.0154 –0.0103
0.1901 0.1669 –0.0093
0.0275 0.0251 0.0294
0.0808 0.0751 0.0022
sum(ans.^2)
ans =
In com pa r in g m odelin g ca pa bilit ies for a given or der IIR m odel, t h e la st r esu lt
sh ows t h a t for t h is exa m ple, stmcb per for m s best , followed by prony, t h en lpc.
Th is r ela t ive per for m a n ce is t ypica l of t h e m odelin g fu n ct ion s.
4-16
Parametric Modeling
b =
0.0466 0.1863 0.2795 0.1863 0.0466
a =
1.0000 –0.7821 0.6800 –0.1827 0.0301
bb =
aa =
bb =
aa =
4-17
4 Special Topics
m in
b, a
∑ w t (k ) h (k )A (w (k )) – B (w (k )) 2
k =1
bbb =
aaa =
4-18
Parametric Modeling
1.4
Original
First Estimate
1.2 Second Estimate
0.8
0.6
0.4
0.2
0
0 0.2 0.4 0.6 0.8 1
ans =
0.0200
ans =
0.0096
4-19
4 Special Topics
Resampling
Th e t oolbox pr ovides a n u m ber of fu n ct ion s t h a t r esa m ple a sign a l a t a h igh er
or lower r a t e.
Operation Function
4-20
Resampling
Th e exa m ple file con t a in s a len gt h 4001 vect or of speech sa m pled a t 7418 H z.
clear
load mtlb
whos
Fs
Fs =
7418
p =
127
q =
115
4-21
4 Special Topics
4-22
Cepstrum Analysis
Cepstrum Analysis
Cepst r u m a n a lysis is a n on lin ea r sign a l pr ocessin g t ech n iqu e wit h a va r iet y of
a pplica t ion s in a r ea s su ch a s speech a n d im a ge pr ocessin g. Th e Sign a l
P r ocessin g Toolbox pr ovides t h r ee fu n ct ion s for cepst r u m a n a lysis.
Operation Function
Th e com plex cepst r u m for a sequ en ce x is ca lcu la t ed by fin din g t h e com plex
n a t u r a l loga r it h m of t h e F ou r ier t r a n sfor m of x, t h en t h e in ver se F ou r ier
t r a n sfor m of t h e r esu lt in g sequ en ce.
π
1
x̂ = ------
2π ∫–π log [ X (e j ω) ] e j ωn d ω
Th e t oolbox fu n ct ion cceps per for m s t h is oper a t ion , est im a t in g t h e com plex
cepst r u m for a n in pu t sequ en ce. It r et u r n s a r ea l sequ en ce t h e sa m e size a s t h e
in pu t sequ en ce
xhat = cceps(x)
4-23
4 Special Topics
0.5
-0.5
-1
-1.5
0 0.2 0.4 0.6 0.8 1 1.2 1.4
Not e t h a t t h e com plex cepst r u m sh ows a pea k a t 0.2 secon ds, in dica t in g t h e
ech o.
Th e real cepstru m of a sign a l x, som et im es ca lled sim ply t h e cepst r u m , is
ca lcu la t ed by det er m in in g t h e n a t u r a l loga r it h m of m a gn it u de of t h e F ou r ier
t r a n sfor m of x, t h en obt a in in g t h e in ver se F ou r ier t r a n sfor m of t h e r esu lt in g
sequ en ce
π
1
c x = ------
2π ∫–π log X (e j ω) e j ωn d ω
4-24
Cepstrum Analysis
xh =
Columns 1 through 7
2.2428 -0.0420 -0.0210 0.0045 0.0366 0.0788 0.1386
Columns 8 through 10
0.2327 0.4114 0.9249
nd =
1
4-25
4 Special Topics
ans =
Columns 1 through 7
1.0000 2.0000 3.0000 4.0000 5.0000 6.0000 7.0000
Columns 8 through 10
8.0000 9.0000 10.0000
4-26
FFT-Based Time-Frequency Analysis
5000
4500
4000
3500
3000
Frequency
2500
2000
1500
1000
500
0
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8
Time
4-27
4 Special Topics
Median Filtering
Th e fu n ct ion medfilt1 im plem en t s on e-dim en sion a l m edia n filt er in g, a
n on lin ea r t ech n iqu e t h a t a pplies a slidin g win dow t o a sequ en ce. Th e m edia n
filt er r epla ces t h e cen t er va lu e in t h e win dow wit h t h e m edia n va lu e of a ll t h e
poin t s wit h in t h e win dow [4]. In com pu t in g t h is m edia n , medfilt1 a ssu m es
zer os beyon d t h e in pu t poin t s.
Wh en t h e n u m ber of elem en t s n in t h e win dow is even , medfilt1 sor t s t h e
n u m ber s, t h en t a kes t h e a ver a ge of t h e ((n–1)/2 & ((n–1)/2)+1) elem en t s.
Two sim ple exa m ples wit h fou r t h - a n d t h ir d-or der m edia n filt er s a r e
medfilt1([4 3 5 2 8 9 1],4)
ans =
medfilt1([4 3 5 2 8 9 1],3)
ans =
3 4 3 5 8 8 1
4-28
Communications Applications
Communications Applications
Th e t oolbox pr ovides t h r ee fu n ct ion s for com m u n ica t ion s sim u la t ion .
Operation Function
wh er e :
• x is t h e m essa ge sign a l.
• Fc is t h e ca r r ier fr equ en cy.
• Fs is t h e sa m plin g fr equ en cy.
• method is a fla g for t h e desir ed m odu la t ion m et h od.
• opt is a n y a ddit ion a l a r gu m en t t h a t t h e m et h od r equ ir es. (Not a ll
m odu la t ion m et h ods r equ ir e a n opt ion a r gu m en t .)
Method Description
4-29
4 Special Topics
Method Description
4-30
Communications Applications
0.5 1
0 0
-0.5 -1
-1 -2
0 0.05 0.1 0.15 0 0.05 0.1 0.15
Demodulated Signal
1
0.5
-0.5
-1
0 0.05 0.1
4-31
4 Special Topics
4-32
Deconvolution
Deconvolution
Decon volu tion , or polyn om ia l division , is t h e in ver se oper a t ion of con volu t ion .
Decon volu t ion is u sefu l in r ecover in g t h e in pu t t o a kn own filt er , given t h e
filt er ed ou t pu t . Th is m et h od is ver y sen sit ive t o n oise in t h e coefficien t s,
h owever , so u se ca u t ion in a pplyin g it .
Th e syn t a x for deconv is
[q,r] = deconv(b,a)
c =
4 13 28 27 18
q =
4 5 6
r =
0 0 0 0 0
See t h e S ystem Id en tification T oolbox User’s Gu id e for a dva n ced a pplica t ion s
of sign a l decon volu t ion .
4-33
4 Special Topics
Specialized Transforms
In a ddit ion t o t h e discr et e F ou r ier t r a n sfor m (DF T) descr ibed in Ch a pt er 1, t h e
Sign a l P r ocessin g Toolbox a n d t h e MATLAB en vir on m en t t oget h er pr ovide t h e
followin g t r a n sfor m fu n ct ion s:
• Th e ch ir p z-t r a n sfor m (CZT), u sefu l in eva lu a t in g t h e z-t r a n sfor m a lon g
con t ou r s ot h er t h a n t h e u n it cir cle. Th e ch ir p z-t r a n sfor m is a lso m or e
efficien t t h a n t h e DF T a lgor it h m for t h e com pu t a t ion of pr im e-len gt h
t r a n sfor m s, a n d it is u sefu l in com pu t in g a su bset of t h e DF T for a sequ en ce.
• Th e discr et e cosin e t r a n sfor m (DCT), closely r ela t ed t o t h e DF T. Th e DCT’s
en er gy com pa ct ion pr oper t ies a r e u sefu l for a pplica t ion s lik e sign a l codin g.
• Th e H ilber t t r a n sfor m , wh ich fa cilit a t es t h e for m a t ion of t h e a n a lyt ic sign a l.
Th e a n a lyt ic sign a l is u sefu l in t h e a r ea of com m u n ica t ion s, pa r t icu la r ly in
ba n dpa ss sign a l pr ocessin g.
Chirp z-Transform
Th e ch ir p z-t r a n sfor m , or CZT, com pu t es t h e z-t r a n sfor m a lon g spir a l con t ou r s
in t h e z-pla n e for a n in pu t sequ en ce. Un like t h e DF T, t h e CZT is n ot
con st r a in ed t o oper a t e a lon g t h e u n it cir cle, bu t ca n eva lu a t e t h e z-t r a n sfor m
a lon g con t ou r s descr ibed by
z l = A W – l , l = 0 , …, M – 1
4-34
Specialized Transforms
On e possible spir a l is
A = 0.8*exp(j*pi/6);
W = 0.995*exp(–j*pi*.05);
M = 91;
z = A*(W.^(–(0:M–1)));
zplane([],z.')
0.5
Imaginary part
-0.5
-1
4-35
4 Special Topics
wh er e
⎧ 1
⎪ ---------, n =1
⎪ N
w (n ) = ⎨
⎪ 2
⎪ ----N
, 2≤n ≤N
⎩
wh er e
⎧ 1
⎪ ---------, k =1
⎪ N
w (k ) = ⎨
⎪ 2
⎪ ----N
, 2≤k ≤N
⎩
4-36
Specialized Transforms
Original Signal
1
0.5
-0.5
-1
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Reconstructed Signal
1
0.5
-0.5
-1
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
4-37
4 Special Topics
Hilbert Transform
Th e t oolbox fu n ct ion hilbert com pu t es t h e H ilber t t r a n sfor m for a r ea l in pu t
sequ en ce x a n d r et u r n s a com plex r esu lt of t h e sa m e len gt h
y = hilbert(x)
wh er e t h e r ea l pa r t of y is t h e or igin a l r ea l da t a a n d t h e im a gin a r y pa r t is t h e
a ct u a l H ilber t t r a n sfor m . y is som et im es ca lled t h e an alytic sign al, in r efer en ce
t o t h e con t in u ou s-t im e a n a lyt ic sign a l. A key pr oper t y of t h e discr et e-t im e
a n a lyt ic sign a l is t h a t it s z-t r a n sfor m is 0 on t h e lower h a lf of t h e u n it cir cle.
Ma n y a pplica t ion s of t h e a n a lyt ic sign a l a r e r ela t ed t o t h is pr oper t y; for
exa m ple, t h e a n a lyt ic sign a l is u sefu l in a voidin g a lia sin g effect s for ba n dpa ss
sa m plin g oper a t ion s. Th e m a gn it u de of t h e a n a lyt ic sign a l is t h e com plex
en velope of t h e or igin a l sign a l.
4-38
Specialized Transforms
0.8
0.6
0.4
0.2
-0.2
-0.4
-0.6
-0.8
-1
0 0.01 0.02 0.03 0.04 0.05
4-39
4 Special Topics
References
1 Ka y, S.M. M od ern S pectral E stim ation . E n glewood Cliffs, NJ : P r en t ice H a ll,
1988.
4 P r a t t ,W.K. Digital Im age Processin g. New Yor k: J oh n Wiley & Son s, 1991.
4-40
5
In t er a ct ive Tools
S P To o l: An In te ra c tiv e S ig n a l P ro c e s s in g E n v iro n m e n t . 5-2
U s in g S P To o l . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-3
U s in g t h e S ig n a l B ro w s e r: In te ra c tiv e S ig n a l An a ly s is . 5-43
Overview
SP Tool is a gr a ph ica l en vir on m en t for a n a lyzin g a n d m a n ipu la t in g digit a l
sign a ls, filt er s, a n d spect r a . It is t h e st a r t in g poin t for u sin g t h e in t er a ct ive
sign a l pr ocessin g en vir on m en t . In SP Tool, you ca n im por t sign a ls, filt er s, a n d
spect r a eit h er fr om t h e wor kspa ce or a s MAT-files. Th r ou gh SP Tool, you a ccess
fou r a ddit ion a l GUI t ools t h a t pr ovide a n in t egr a t ed en vir on m en t for sign a l
br owsin g, filt er design , a n a lysis, a n d im plem en t a t ion . Th e fou r com pon en t s of
t h e in t er a ct ive sign a l pr ocessin g en vir on m en t in clu de:
• Th e S ign al B row ser, wh ich pr ovides a gr a ph ica l view of t h e sign a l object s
cu r r en t ly select ed in SP Tool a n d en a bles you t o displa y, m ea su r e, a n a lyze,
a n d pr in t t h ese sign a ls in t er a ct ively
• Th e Filter Design er, wh ich en a bles you t o cr ea t e a n d edit lowpa ss, h igh pa ss,
ba n dpa ss, a n d ba n dst op F IR a n d IIR digit a l filt er s of va r iou s len gt h s a n d
t ypes u sin g t h e filt er design fu n ct ion s of t h e Sign a l P r ocessin g Toolbox
• Th e Filter View er, wh ich en a bles you t o view va r iou s ch a r a ct er ist ics of a
filt er t h a t you ’ve im por t ed or design ed, in clu din g it s m a gn it u de a n d ph a se
r espon ses, gr ou p dela y, zer o-pole plot , a n d im pu lse a n d st ep r espon ses
• Th e S pectru m View er, wh ich en a bles you t o cr ea t e, view, m odify, a n d pr in t
spect r a in t er a ct ively, a n d t o per for m gr a ph ica l a n a lysis of fr equ en cy dom a in
da t a u sin g a va r iet y of com m on m et h ods of spect r a l est im a t ion
5-2
Using SPTool
Using SPTool
SP Tool is t h e da t a m a n a gem en t t ool for t h e in t er a ct ive GUI en vir on m en t of t h e
Sign a l P r ocessin g Toolbox. Usin g SP Tool you ca n :
Opening SPTool
Open SP Tool fr om t h e MATLAB com m a n d win dow by t ypin g
sptool
a n d pr essin g En te r .
Quick Start
On ce SP Tool is open , you ca n im por t da t a fr om t h e wor kspa ce or a file. You ca n
t h en view it in t h e Sign a l Br owser or gen er a t e it s spect r u m in t h e Spect r u m
Viewer .
To get st a r t ed r igh t a wa y, wor k t h r ou gh t h e followin g exa m ple. Th en con t in u e
t h r ou gh t h is ch a pt er t o lea r n t h e det a ils of u sin g SP Tool a n d it s com pon en t
t ools.
Or , you ca n sk ip t h e exa m ple, r ea d t h r ou gh t h e r est of t h is sect ion (fr om “Ba sic
SP Tool F u n ct ion s” t o “Usin g t h e Sign a l Br owser : In t er a ct ive Sign a l An a lysis”),
a n d t h en wor k t h r ou gh t h e exa m ple.
5-3
5 Interactive Tools
1 Select Im p o rt fr om t h e F ile m en u .
3 P r ess t h e F ro m D is k r a dio bu t t on .
5-4
Using SPTool
7 P r ess OK .
5-5
5 Interactive Tools
File Menu
Help Menu
5-6
Using SPTool
Load the contents of a file into the File Contents list by clicking here, and
either typing a filename in the box and pressing Tab or Enter, or pressing
Browse and selecting a MAT-file.
5-7
5 Interactive Tools
1 Click t h e F ro m Wo rk s p a c e r a dio bu t t on .
1 Click t h e F ro m D is k r a dio bu t t on .
or
5-8
Using SPTool
5-9
5 Interactive Tools
4 P r ess OK .
5-10
Using SPTool
Importing a Filter. Wh en you im por t a filt er , fir st select t h e a ppr opr ia t e filt er
for m fr om t h e F o rm pop-u p m en u .
5-11
5 Interactive Tools
Z (z ) ( z – z ( 1 ) ) ( z – z ( 2 ) )Lz ( – z (m ))
H (z ) = ---------- = k ---------------------------------------------------------------------------------
P (z ) ( z – p ( 1 ) ) ( z – p ( 2 ) )Lz ( – p (n ))
- Th e Ze ro s field specifies a va r ia ble n a m e or va lu e for t h e zer os vect or z,
wh ich con t a in s t h e loca t ion s of m zer os.
- Th e P o le s field specifies a va r ia ble n a m e or va lu e for t h e zer os vect or p,
wh ich con t a in s t h e loca t ion s of n poles.
- Th e Ga in field specifies a va r ia ble n a m e or va lu e for t h e ga in k .
• F or 2n d Ord e r S e c tio n s you specify t h e filt er by it s secon d-or der sect ion
r epr esen t a t ion :
L L
b 0 k + b 1 k z – 1 + b 2 k z –2
H (z ) = ∏ H k (z ) = ∏ ---------------------------------------------------------
1 + a 1 k z –1 + a 2 k z – 2
-
k =1 k =1
b 01 b 11 b 21 1 a 11 a 21
b 02 b 12 b 22 1 a 12 a 22
s os =
M M M M M M
b0L b1L b2L 1 a1L a2L
5-12
Using SPTool
5-13
5 Interactive Tools
Signals list
Filters list
Spectra list
5-14
Using SPTool
5-15
5 Interactive Tools
2 Type in t h e n ew n a m e a n d pr ess OK .
5-16
Using SPTool
Viewing a Signal
Use t h e Sign a l Vie w bu t t on t o m a ke t h e Sign a l Br owser a ct ive a n d view on e or
m or e im por t ed sign a ls. Th e Sign a l Br owser pr ovides t ools for gr a ph ica l
a n a lysis of t h e select ed sign a l(s).
Select on e or m or e sign a ls fr om t h e S ig n a ls list a n d pr ess t h e Vi e w bu t t on in
t h e sign a l pa n el. Th e Sign a l Br owser displa ys t h e select ed sign a l(s). See “Usin g
t h e Sign a l Br owser : In t er a ct ive Sign a l An a lysis” on pa ge 5-43 for a fu ll
descr ipt ion of Sign a l Br owser fu n ct ion s a n d oper a t ion s.
Viewing a Filter
Use t h e Vie w bu t t on in t h e F ilte rs pa n el t o m a ke t h e F ilt er Viewer a ct ive a n d
view im por t ed filt er s or filt er s design ed/edit ed in t h e F ilt er Design er . Th e
F ilt er Viewer pr ovides t ools for a n a lyzin g filt er s; you ca n in vest iga t e t h e
m a gn it u de r espon se, ph a se, gr ou p dela y, zer os a n d poles, a n d im pu lse a n d st ep
r espon ses of t h e select ed filt er s.
Select on e or m or e filt er s fr om t h e F i lte rs list a n d pr ess t h e Vie w bu t t on in t h e
filt er pa n el. Th e F ilt er Viewer displa ys t h e select ed filt er s. See “Usin g t h e
F ilt er Viewer : In t er a ct ive F ilt er An a lysis” on pa ge 5-84 for a fu ll descr ipt ion of
F ilt er Viewer fu n ct ion s a n d oper a t ion s.
Designing a Filter
5-17
5 Interactive Tools
Applying a Filter
Use t h e Ap p ly F ilte r bu t t on t o a pply a filt er t o a select ed sign a l. Th is cr ea t es
a n ew sign a l:
5-18
Using SPTool
Creating a Spectrum
Use t h e Cre a te bu t t on t o a ct iva t e t h e Spect r u m Viewer a n d gen er a t e a defa u lt
spect r u m of a select ed sign a l. On ce you ’ve gen er a t ed a spect r u m , you ca n view
it in a va r iet y of wa ys, m ea su r e it , a n d m odify it in t h e Spect r u m Viewer .
Viewing a Spectrum
Select on e or m or e spect r a fr om t h e S p e c tra list a n d pr ess Vie w in t h e S p e c tra
pa n el. Th e Spect r u m Viewer displa ys t h e select ed spect r u m or spect r a .
Updating a Spectrum
Use t h e U p d a te bu t t on t o u pda t e t h e select ed spect r u m so t h a t it r eflect s t h e
da t a in t h e cu r r en t ly select ed sign a l.
5-19
5 Interactive Tools
Customizing Preferences
Use P re fe re n c e s … fr om t h e F ile m en u t o cu st om ize displa ys a n d cer t a in
pa r a m et er s for SP Tool a n d it s fou r com pon en t t ools. Th e n ew set t in gs a r e
sa ved on disk a n d a r e u sed wh en you r est a r t MATLAB.
In t h e P re fe re n c e s pa n els, you ca n :
• Select color s a n d m a r ker s for r u ler s, a n d set t h e in it ia l r u ler st yle
• Select color a n d lin e st yle sequ en ce for displa yed sign a ls
• Con figu r e a xis la bels, a n d en a ble/disa ble r u ler s, pa n n er , a n d m ou se zoom in
t h e Sign a l Br owser
• Con figu r e a xis pa r a m et er s, a n d en a ble/disa ble r u ler s a n d m ou se zoom in t h e
Spect r u m Viewer
• Con figu r e filt er a n d a xis pa r a m et er s a n d en a ble/disa ble m ou se zoom in t h e
F ilt er Viewer
• Con figu r e t ilin g pr efer en ces in t h e F ilt er Viewer
• Specify F F T len gt h , a n d en a ble/disa ble m ou se zoom a n d gr id in t h e F ilt er
Design er
• E n a ble/disa ble u se of a defa u lt session file
• Con figu r e filt er s for expor t t o t h e Con t r ol Syst em Toolbox (for u ser s of t h a t
pr odu ct )
• E n a ble/disa ble sea r ch for plu g-in s a t st a r t -u p
5-20
Using SPTool
Ruler Settings
Th e R u le rs pr efer en ces a pply t o t h e r u ler s in t h e Sign a l Br owser , Spect r u m
Viewer , a n d F ilt er Viewer . Th ese pr efer en ces a lso a pply t o pr in t ou t s fr om t h e
Sign a l Br owser a n d Spect r u m Viewer .
Initial Type. Specifies t h e t ype of r u ler (h or izon t a l, ver t ica l, t r a ck, or slope) t h a t
is select ed wh en you fir st open t h e Sign a l Br owser , Spect r u m Viewer , or F ilt er
Viewer .
5-21
5 Interactive Tools
Color Settings
Th e Co lo rs pr efer en ces a pply t o sign a ls displa yed in t h e Sign a l Br owser ,
Spect r u m Viewer , a n d F ilt er Viewer . Th ese pr efer en ces a lso a pply t o pr in t ou t s
fr om t h e Sign a l Br owser a n d Spect r u m Viewer .
5-22
Using SPTool
X Label, Y Label. Type in a st r in g for t h e x-a xis la bel a n d t h e y-a xis la bel in t h e
Sign a l Br owser . Th e defa u lt is Time for t h e x-a xis.
Rulers. Click in t h e ch eck box t o displa y (ch ecked) or h ide (u n ch eck ed) t h e r u ler
bu t t on s a n d t h e r u ler pa n el in t h e Sign a l Br owser . See “Ru ler Con t r ols” on
pa ge 5-33 for det a ils on u sin g t h e r u ler s in t h e Sign a l Br owser .
Panner. Click in t h e ch eck box t o displa y (ch eck ed) or h ide (u n ch ecked) t h e
pa n n er in t h e Sign a l Br owser . See “P a n n er Displa y” on pa ge 5-52 for det a ils on
u sin g t h e pa n n er in t h e Sign a l Br owser .
Stay in Zoom-mode After Zoom. Click in t h e ch eck box t o en a ble (ch ecked) or
disa ble (u n ch eck ed) zoom per sist en ce in t h e Sign a l Br owser . See “Zoom
Con t r ols” on pa ge 5-31 for det a ils on zoom con t r ols in t h e Sign a l Br owser .
5-23
5 Interactive Tools
Frequency Axis Scaling. Specifies t h e sca lin g u n it s for t h e fr equ en cy (x) a xis in t h e
Spect r u m Viewer . Sca lin g u n it s ca n be lin e a r or lo g .
Rulers. Click in t h e ch eck box t o displa y (ch eck ed) or h ide (u n ch ecked) t h e r u ler
bu t t on s a n d t h e r u ler pa n el in t h e Spect r u m Viewer . See “Ru ler Con t r ols” on
pa ge 5-33 for det a ils on u sin g t h e r u ler s in t h e Spect r u m Viewer .
Stay in Zoom-mode After Zoom. Click in t h e ch eck box t o en a ble (ch eck ed) or
disa ble (u n ch ecked) zoom per sist en ce in t h e Spect r u m Viewer . See “Zoom
Con t r ols” on pa ge 5-31 for det a ils on zoom con t r ols in t h e Spect r u m Viewer .
5-24
Using SPTool
Frequency Axis Scaling. Specifies t h e sca lin g u n it s for t h e fr equ en cy (x) a xis in t h e
F ilt er Viewer . Sca lin g u n it s ca n be li n e a r or lo g .
5-25
5 Interactive Tools
Rulers. Click in t h e ch eck box t o displa y (ch eck ed) or h ide (u n ch ecked) t h e r u ler
bu t t on s a n d t h e r u ler pa n el in t h e F ilt er Viewer . See “Ru ler Con t r ols” on pa ge
5-33 for det a ils on u sin g t h e r u ler s in t h e F ilt er Viewer .
Stay in Zoom-mode After Zoom. Click in t h e ch eck box t o en a ble (ch eck ed) or
disa ble (u n ch ecked) zoom per sist en ce in t h e F ilt er Viewer . See “Zoom Con t r ols”
on pa ge 5-31 for det a ils on zoom con t r ols in t h e F ilt er Viewer .
5-26
Using SPTool
Display grid lines. Tu r n s plot gr id lin es on (ch ecked) or off (u n ch eck ed).
Stay in Zoom-mode After Zoom. Tu r n s per sist en t zoom in g on a n d off, a s descr ibed
in “Zoom Con t r ols” on pa ge 5-31.
5-27
5 Interactive Tools
Default Session. E n a bles (ch ecked) or disa bles (u n ch eck ed) loa din g of a defa u lt
session file, wh ich m u st h a ve t h e n a m e startup.spt, wh en st a r t in g SP Tool.
An SP Tool session file is a MAT-file (see Usin g M AT L AB ) wit h a .spt
ext en sion .
Th e D e fa u lt S e s s io n pr efer en ce on ly a ffect s t h e session con t en t s wh en you
st a r t SP Tool. You ca n loa d a n ew session file a ft er st a r t in g SP Tool u sin g t h e
Op e n S e s s io n opt ion in t h e SP Tool F ile m en u . You ca n a lso sa ve a session file
a t a n y t im e u sin g t h e S a v e S e s s io n opt ion in t h e F ile m en u . If you close SP Tool
wit h ou t h a vin g r ecen t ly sa ved a session file, you will be pr om pt ed t o do so. (See
“F ile Men u ” on pa ge 5-6.)
5-28
Using SPTool
Export Filters as TF objects. E n a bles (ch eck ed) or disa bles (u n ch ecked) expor t in g of
SP Tool filt er s a s TF (t r a n sfer fu n ct ion ) object s, for u se in t h e Con t r ol Syst em
Toolbox (see t h e Con trol S ystem T oolbox User’s Gu id e).
5-29
5 Interactive Tools
Plug-Ins Setting
Th e P lu g -In s pr efer en ce let s you sea r ch for plu g-in s wh en SP Tool is st a r t ed u p.
Search for Plug-Ins at start-up. E n a bles (ch ecked) or disa bles (u n ch eck ed)
sea r ch in g for in st a lled plu g-in s.
A plu g-in is a n ext en sion t o SP Tool. P lu g-in s in clu de cu st om ized a dd-on pa n els
a n d n ew bu t t on s in t h e pa n els in SP Tool, n ew spect r a l m et h ods in t h e
Spect r u m Viewer , a n d n ew SP Tool pr efer en ces. You ca n a lso plu g on e or m or e
t oolboxes in t o SP Tool.
You n eed t o u se t h is set t in g on ly wh en you h a ve in st a lled ext en sion s or h a ve
ot h er t oolboxes plu gged in t o SP Tool.
To u se SP Tool wit h ext en sion s, ch eck S e a rc h fo r P lu g -i n s a t s ta rt-u p , close
SP Tool, a n d r est a r t it .
5-30
Using SPTool
Zoom Controls
Th e GUI t ools sh a r e a com m on set of zoom con t r ol bu t t on s. Th e Sign a l Br owser
a n d Spect r u m Viewer u se t h e sa m e set of com m on zoom con t r ol bu t t on s, wh ich
a ffect bot h on -scr een a n d pr in t ed im a ges.
5-31
5 Interactive Tools
Zoom In-X, Zoom Out-X, Zoom In-Y, and Zoom Out-Y. Click on ce t o per for m on e zoom
oper a t ion (in or ou t ) on t h e x- or y-a xis. E a ch zoom oper a t ion ch a n ges t h e a xes
lim it s by a fa ct or of t wo on t h e specified a xis, a bou t t h e cen t er of t h e displa yed
sign a l. You ca n pr ess r epea t edly on on e or m or e bu t t on s t o con t in u e t o ch a n ge
t h e sca le in on e or bot h a xes.
Wh en you zoom in t h e x-a xis (h or izon t a l sca lin g), t h e y lim it s (ver t ica l sca lin g)
of t h e m a in a xes a r e n ot ch a n ged. Sim ila r ly, wh en you zoom in t h e y-a xis, t h e
x lim it s of t h e m a in a xes a r e n ot ch a n ged.
• To zoom in wit h ou t specifyin g a zoom win dow, click on t h e plot . Th e posit ion
of t h e cr ossh a ir is t h e cen t er of a zoom oper a t ion t h a t h a lves bot h t h e x- a n d
y-a xis lim it s.
• To u se a zoom r ect a n gle, click wh er e you wa n t t h e r ect a n gle t o begin , dr a g
t h e m ou se dia gon a lly t o wh er e you wa n t it t o en d, a n d r elea se t h e m ou se
bu t t on .
• To get ou t of m ou se zoom m ode wit h ou t zoom in g in or ou t , pr ess t h e Mo u s e
Zo o m bu t t on a ga in .
5-32
Using SPTool
Ruler Controls
Th e Sign a l Br owser , F ilt er Viewer , a n d Spect r u m Viewer sh a r e a com m on set
of r u ler con t r ols. Use t h e r u ler s t o m a ke m ea su r em en t s on t h e sign a ls or
spect r a in t h e m a in a xes (displa y) a r ea . Th e r u ler con t r ols give you a va r iet y of
wa ys t o r ea d a n d con t r ol t h e va lu es of t h e r u ler s in t h e m a in a xes. Wit h t h e
r u ler s you ca n m ea su r e su ch in for m a t ion a s t h e ver t ica l a n d h or izon t a l
dist a n ce bet ween fea t u r es in a sign a l or spect r u m , t h e dim en sion s of pea k s a n d
va lleys, a n d slope in for m a t ion .
In t h e followin g discu ssion , t h e Sign a l Br owser is sh own . Th e r u ler con t r ols
in clu de t h e S e le c tio n con t r ols a t t h e t op r igh t of t h e win dow a n d t h e bu t t on s
a n d edit boxes in t h e Ru le rs pa n el. Th e con t r ols in t h e F ilt er Viewer a n d
Spect r u m Viewer wor k t h e sa m e wa y. Th e con t r ols in t h e Sign a l Br owser a n d
t h e Spect r u m Viewer a lso a ffect im a ges pr in t ed fr om t h ese t ools.
In t h e F ilt er Viewer , t h e r u ler s a ppea r on on ly on e su bplot a t a t im e. You ca n
ch oose wh ich su bplot t h e r u ler s a ppea r on by select in g t h e su bplot fr om t h e
pop-u p m en u a t t h e t op of t h e R u le rs pa n el, or by clickin g on a lin e in t h e plot
t h a t you wa n t t o m ea su r e. If a su bplot is n ot cu r r en t ly visible wh en you select
it s n a m e fr om t h e pop-u p m en u , t h e F ilt er Viewer cr ea t es t h e su bplot a n d
pla ces t h e r u ler s in it .
5-33
5 Interactive Tools
Color… button
Edit boxes
Rulers panel
5-34
Using SPTool
Line Selection Pop-Up Menu. Use t o select a lin e (vect or sign a l, a r r a y colu m n ,
filt er , or spect r u m ) t o m ea su r e.
Click t h e S e le c ti o n pop-u p m en u a n d dr a g t o select t h e lin e.
Line Selection Display. Th e lin e color a n d st yle of t h e select ed sign a l a r e displa yed.
Color… Button. Use t o edit t h e lin e st yle or displa y color of t h e select ed lin e.
5-35
5 Interactive Tools
Rulers Panel and Edit Boxes. Th e R u le rs pa n el ch a n ges depen din g on wh ich r u ler
con t r ol is select ed: Ve rtic a l , Ho rizo n ta l , Tra c k , or S lo p e . It sh ows t h e
pa r a m et er s for t h e select ed r u ler con t r ol. Depen din g on wh ich r u ler con t r ol is
select ed, t h e followin g fields a r e displa yed: x 1 , y 1 , x 2 , y 2 , d x , d y , m . Th e
pict u r e on t h e left sh ows t h e R u le rs pa n el wh en S lo p e is select ed.
Wh en you pr ess a r u ler con t r ol bu t t on , r u ler s a r e displa yed su per im posed on
t h e sign a l(s) in t h e m a in a xes displa y a r ea . Th e r u ler s a r e eit h er ver t ica l (for
Ve rtic a l , Tra c k , a n d S lo p e ) or h or izon t a l (for Ho rizo n ta l ). F or Tra c k a n d
S lo p e , r u ler m a r k er s a r e a lso displa yed. Th e r u ler s a n d r u ler m a r k er s a r e
a ssocia t ed wit h t h e cu r r en t ly select ed sign a l. Th e followin g pict u r e sh ows t h e
r u ler s a n d r u ler m a r k er s t h a t a r e displa yed wh en S lo p e is select ed.
5-36
Using SPTool
1 Click S a v e R u le rs … t o sa ve t h e cu r r en t m ea su r em en t s a s a va r ia ble in t h e
wor kspa ce.
5-37
5 Interactive Tools
5-38
Using SPTool
5-39
5 Interactive Tools
5-40
Using SPTool
r u ler 1 on t h e y-a xis), x 2 (t h e posit ion of r u ler 2 on t h e x-a xis), y 2 (t h e posit ion
of r u ler 2 on t h e y-a xis), d x (t h e va lu e of x 2 -x 1 ), a n d d y (t h e va lu e of y 2 -y 1).
5-41
5 Interactive Tools
5-42
Using the Signal Browser: Interactive Signal Analysis
5-43
5 Interactive Tools
Display management controls Viewing (zoom) controls Measuring (line and ruler) controls
Main axes
(display) area
Panner
5-44
Using the Signal Browser: Interactive Signal Analysis
Menus
5-45
5 Interactive Tools
Zoom Controls
Th e a va ila ble zoom con t r ols in t h e Sign a l Br owser a r e Mo u s e Zo o m , F u ll
Vie w , Zo o m In -Y, Zo o m Ou t-Y, Zo o m In -X, a n d Zo o m Ou t-X. See “Zoom
Con t r ols” on pa ge 5-31 for det a ils on u sin g t h e zoom con t r ols in t h e Sign a l
Br owser .
Zoom per sist en ce is off by defa u lt in t h e Sign a l Br owser ; u se t h e Sign a l
Br owser set t in gs pa n el in t h e P re fe re n c e s dia log box in SP Tool t o t oggle zoom
per sist en ce on a n d off. See “Sign a l Br owser Set t in gs” on pa ge 5-23.
Help Button
To u se con t ext -sen sit ive h elp, pr ess t h e He lp bu t t on . Th e m ou se poin t er
becom es a n a r r ow wit h a qu est ion m a r k sym bol. You ca n t h en click on a n yt h in g
in t h e Sign a l Br owser , in clu din g m en u it em s, t o fin d ou t wh a t it is a n d h ow t o
u se it .
5-46
Using the Signal Browser: Interactive Signal Analysis
1 P r ess Arra y S i g n a ls …
5-47
5 Interactive Tools
Axes Labels. By defa u lt , t h e x-a xis in t h e Sign a l Br owser is la beled Time. You
ca n ch a n ge t h e x-a xis la bel a n d a dd a y-a xis la bel u sin g t h e S ig n a l B ro w s e r
set t in gs pa n el in t h e P re fe re n c e s dia log box in SP Tool. See “Sign a l Br owser
Set t in gs” on pa ge 5-23.
Panner
Th e pa n n er gives a pa n or a m ic view of t h e sign a l(s) displa yed in t h e m a in a xes.
Th e pa n n er a lwa ys displa ys t h e en t ir e sign a l sa m ple. Wh en you zoom in on t h e
m a in a xes, a pa t ch in t h e pa n n er sh ows t h e sect ion of t h e plot t h a t is cu r r en t ly
in view in t h e m a in a xes. Click-a n d-dr a g t h e pa t ch in t h e pa n n er win dow t o pa n
dyn a m ica lly a cr oss t h e sign a l da t a in t h e m a in a xes.
You ca n a lso select a lin e by clickin g on it in t h e pa n n er ; t h e select ed lin e is
h igh ligh t ed in bot h t h e pa n n er a n d in t h e m a in a xes displa y a r ea .
5-48
Using the Signal Browser: Interactive Signal Analysis
5-49
5 Interactive Tools
5-50
Using the Signal Browser: Interactive Signal Analysis
5-51
5 Interactive Tools
Panner Display
Th e pa n n er displa ys t h e en t ir e sign a l sa m ple a t a ll t im es.
5-52
Using the Signal Browser: Interactive Signal Analysis
Manipulating Displays
5-53
5 Interactive Tools
5-54
Using the Signal Browser: Interactive Signal Analysis
5-55
5 Interactive Tools
5-56
Using the Signal Browser: Interactive Signal Analysis
by ch a n ges t o t h e Sign a l Br owser pr efer en ces (see “Sign a l Br owser Set t in gs”
on pa ge 5-23).
5-57
5 Interactive Tools
5-58
Using the Filter Designer: Interactive Filter Design
5-59
5 Interactive Tools
Menus
5-60
Using the Filter Designer: Interactive Filter Design
General controls
Zoom Controls
Th e a va ila ble zoom con t r ols in t h e F ilt er Design er a r e Zo o m In -Y, Zo o m
Ou t-Y, Zo o m In -X, Zo o m Ou t-X, P a s s B a n d , F u ll Vie w , a n d Mo u s e Zo o m .
See “Zoom Con t r ols” on pa ge 5-31 for det a ils on u sin g t h e zoom con t r ols.
Zoom per sist en ce is off by defa u lt in t h e F ilt er Design er ; u se t h e F ilt er
Design er set t in gs pa n el in t h e P re fe re n c e s dia log box t o t oggle zoom
per sist en ce on a n d off. See “F ilt er Design er Set t in gs” on pa ge 5-27.
Help Button
To u se con t ext -sen sit ive h elp, pr ess t h e He lp bu t t on . Th e m ou se poin t er
becom es a n a r r ow wit h a qu est ion m a r k sym bol. You ca n t h en click on a n y
5-61
5 Interactive Tools
General Controls
Ben ea t h t h e zoom con t r ols a r e sever a l gen er a l con t r ols for filt er design a n d
displa y. Som e of t h ese con t r ols a r e a va ila ble on ly wh en a n opt im a l filt er design
m et h od (e.g., Equ i rip p le F IR , B u tte rw o rth IIR ) is select ed fr om t h e
Alg o rith m m en u , a n d a r e n ot a va ila ble wh en t h e P o le /Ze ro Ed ito r is select ed.
Optimal design
methods
Transfer function
pole-zero placement
Wh en you select on e of t h e opt im a l design m et h ods fr om t h e m en u , t h e
m a gn it u de r espon se plot , S p e c i fic a tio n s pa n el, a n d Me a s u re m e n ts pa n el a ll
u pda t e t o r eflect t h e design pa r a m et er s a va ila ble for t h a t m et h od. Wh en you
select P o le /Ze ro Ed ito r , t h e m a gn it u de r espon se plot is r epla ced by t h e z-pla n e
for pole-zer o pla cem en t .
5-62
Using the Filter Designer: Interactive Filter Design
Overlay Spectrum (design methods only). Th e F ilt er Design er a llows you t o over la y
a sign a l spect r u m on t h e filt er ’s m a gn it u de r espon se plot . P r ess t h e Ov e rla y
S p e c tru m ... bu t t on t o displa y a list of t h e cu r r en t spect r a in SP Tool. Select a
spect r u m fr om t h e list a n d pr ess OK t o over la y it on t h e cu r r en t m a gn it u de
r espon se plot . Not e t h a t t h e spect r u m is plot t ed on t h e exist in g fr equ en cy a xis,
wh ich is sca led t o t h e filt er ’s sa m plin g fr equ en cy.
5-63
5 Interactive Tools
Designing a New Filter With the Design Methods. In gen er a l, follow t h ese st eps t o
design a n ew filt er u sin g t h e S p e c i fi c a tio n s pa n el pa r a m et er s:
5-64
Using the Filter Designer: Interactive Filter Design
5 To specify a filt er or der , pr ess Min im ize Ord e r t o deselect t h e ch eck box a n d
disa ble a u t om a t ic filt er or der select ion . Th en t ype a va lu e for t h e Ord e r
pa r a m et er . If Au to D e s ig n is n ot ch ecked, pr ess Ap p ly .
5-65
5 Interactive Tools
Z (z ) ( z – z 1 ) ( z – z 2 )Lz ( – zm )
H (z ) = ---------- = k ----------------------------------------------------------------
P (z ) ( z – p 1 ) ( z – p 2 )Lz ( – pn )
5-66
Using the Filter Designer: Interactive Filter Design
z = X + jY
Th e Co n ju g a te p a ir ch eckbox con t r ols wh et h er t h e cu r r en t select ion is a
com plex con ju ga t e pa ir of poles or zer os, or a lon e pole or zer o. Wh en a lon e pole
or zer o is select ed on t h e pole-zer o plot , t h e Co n ju g a te p a ir ch eckbox is
in a ct ive. If you n ow en a ble t h e Co n ju g a te p a ir ch eckbox by clickin g it , a n ew
con ju ga t e pole or zer o (a s a ppr opr ia t e) is cr ea t ed t o com plet e t h e pa ir .
Wh en a con ju ga t e pa ir of poles or zer os is select ed on t h e plot (by click in g on e
of t h e pa ir ), t h e Co n ju g a te p a ir ch eckbox is a ct ive. If you n ow disa ble t h e
Co n ju g a te p a ir ch eckbox by click in g it , t h e con ju ga t e pa ir is br oken in t o t wo
lon e poles or zer os a t t h e sa m e posit ion s, a n d on ly on e of t h ese r em a in s
select ed.
Wh en t h e Co n ju g a te p a ir ch eckbox is select ed, t h e coor din a t es you specify (in
eit h er a n gu la r or r ect a n gu la r for m ) con t r ol t h e loca t ion of t h e cu r r en t ly
select ed com plex con ju ga t e pa ir of poles or zer os, wit h loca t ion s
z = X ± jY
or
±j θ
z = Me
Designing a New Filter with the Pole/Zero Editor. In gen er a l, follow t h ese st eps t o
design a n ew filt er u sin g t h e S p e c ific a tio n s pa n el pa r a m et er s:
5-67
5 Interactive Tools
TIP Keep t h e F ilt er Viewer open wh ile design in g a filt er wit h t h e Pole/Zer o
E dit or. An y ch a n ges t h a t you m a k e t o t h e filt er t r a n sfer fu n ct ion in t h e
Pole/Zer o E dit or a r e t h en sim u lt a n eou sly r eflect ed in t h e r espon se plot s of t h e
Filt er Viewer.
5-68
Using the Filter Designer: Interactive Filter Design
Add Poles Pointer Wh en a n ew pole or zer o is bein g pla ced on t h e plot (u sin g t h e Ad d P o le s or
Add Zeros Pointer Ad d Ze ro s t ools, descr ibed on pa ge 5-72) t h e Me a s u re m e n ts pa n el sh ows
a ddit ion a l posit ion in g in for m a t ion . Aft er pr essin g eit h er t h e Ad d P o le s or Ad d
Ze ro s bu t t on , a n d befor e clickin g on t h e plot t o pla ce t h e n ew pole(s) or zer o(s),
t h e Me a s u re m e n ts pa n el displa ys t h e pr ecise posit ion of t h e poin t er over t h e
plot a r ea .
5-69
5 Interactive Tools
• Set edge fr equ en cies eit h er by clickin g on t h e edge of a h orizon tal gr een lin e
(t h e m ou se poin t er ch a n ges t o ) a n d dr a ggin g t h e edge t o a n ew fr equ en cy,
or by click in g a n ywh er e on a vertical gr een lin e (if t h e F ilt er Design er
pr ovides on e) a n d dr a ggin g it h or izon t a lly t o a n ew fr equ en cy. Th e F p a n d F s
va lu es displa yed in t h e S p e c ific a tio n s pa n el ch a n ge a s you dr a g. If Au to
D e s ig n is ch ecked, t h e r espon se plot a lso u pda t es a s you dr a g t h e lin es. If
Au to D e s i g n is disa bled, t h e r espon se plot u pda t es wh en you r elea se t h e
m ou se.
5-70
Using the Filter Designer: Interactive Filter Design
Positioning Poles and Zeros. You ca n r edesign t h e t r a n sfer fu n ct ion by sim ply
clickin g a n d dr a ggin g on on e of t h e pole or zer o sym bols. P oles or zer os a ppea r
gr een (r a t h er t h a n t h e u su a l blu e) wh en select ed. In a con ju ga t e pa ir of poles
or zer os, bot h con ju ga t es a r e select ed wh en eit h er is click ed; con ju ga t e pa ir s
m ove t oget h er wh en dr a gged, m a in t a in in g equ a l dist a n ce fr om t h e r ea l a xis a t
a ll t im es. To u n gr ou p con ju ga t es, select t h e desir ed pa ir a n d u n ch eck
Co n ju g a te p a ir in t h e S p e c i fi c a tio n s pa n el.
5-71
5 Interactive Tools
5-72
Using the Filter Designer: Interactive Filter Design
5-73
5 Interactive Tools
R p a n d Rs a r e specified in dB.
9 P r ess t h e Ap p ly bu t t on .
5-74
Using the Filter Designer: Interactive Filter Design
All of t h e F IR filt er design opt ion s in t h e F ilt er Design er r equ ir e a n even filt er
or der for t h e h igh pa ss a n d ba n dst op con figu r a t ion s. F or m or e in for m a t ion on
or der select ion wit h t h e F IR filt er design opt ion s, see t h e r efer en ce descr ipt ion s
of remez, remezord, kaiserord, firls, a n d fir1 in Ch a pt er 6.
5-75
5 Interactive Tools
6 Set F p (pa ssba n d edge fr equ en cy) t o 800 a n d F s (st opba n d edge fr equ en cy)
t o 700.
F p a n d F s a r e specified in H er t z.
R p a n d Rs a r e specified in dB.
5-76
Using the Filter Designer: Interactive Filter Design
5-77
5 Interactive Tools
5-78
Using the Filter Designer: Interactive Filter Design
5-79
5 Interactive Tools
B (z ) b (1 ) + b (2 )z –1 + L+ b (n b + 1 )z – m
H (z ) = ----------- = --------------------------------------------------------------------------------------
A (z ) a (1 ) + a (2 )z – 1 + L+ a (n a + 1 )z – n
wh er e b is a vect or con t a in in g t h e coefficien t s fr om t h e tf.num field, a is a
vect or con t a in in g t h e coefficien t s fr om t h e tf.den field, m is t h e n u m er a t or
or der , a n d n is t h e den om in a t or or der . You ca n ch a n ge t h e filt er r epr esen t a t ion
fr om t h e defa u lt t r a n sfer fu n ct ion t o a n ot h er for m by u sin g t h e tf2ss or tf2zp
fu n ct ion s.
currentModule Algorithm
5-80
Using the Filter Designer: Interactive Filter Design
Parameter Description
5-81
5 Interactive Tools
Parameter Description
5-82
Using the Filter Designer: Interactive Filter Design
5-83
5 Interactive Tools
5-84
Using the Filter Viewer: Interactive Filter Analysis
Filter ID panel
5-85
5 Interactive Tools
You ca n ch oose t o displa y on e or a n y com bin a t ion of t h e six a va ila ble su bplot s
by u sin g t h e ch eck boxes in t h e P lo ts pa n el, a n d you ca n m odify m a n y of t h e
plot displa y ch a r a ct er ist ics u sin g t h e pop-u p m en u s in t h e P lo ts pa n el a n d t h e
F re qu e n c y Ax i s pa n el.
Menus
File Menu. Use Clo s e fr om t h e F ile m en u t o close t h e F ilt er Viewer . Set t in gs you
ch a n ged a n d sa ved u sin g t h e P re fe re n c e s dia log box in SP Tool a r e sa ved a n d
u sed t h e n ext t im e you open a F ilt er Viewer .
Plots Panel
Th e ch eck boxes in t h is pa n el select t h e su bplot s t o displa y in t h e m a in plot s
a r ea . An y com bin a t ion of su bplot s m a y be displa yed.
To displa y a su bplot , ch eck t h e box a t t h e left of t h e plot descr ipt ion .
Th er e a r e six a va ila ble su bplot s:
5-86
Using the Filter Viewer: Interactive Filter Analysis
Zoom Controls
Th e a va ila ble zoom con t r ols in t h e F ilt er Viewer a r e Mo u s e Zo o m a n d F u ll
Vie w . You ca n zoom in depen den t ly in ea ch displa yed su bplot .
By defa u lt , per sist en t zoom in g is disa bled in t h e F ilt er Viewer . You ca n t u r n
per sist en t zoom in g on fr om t h e F ilte r Vie w e r set t in gs pa n el of t h e
P re fe re n c e s dia log box in SP Tool.
See “Zoom Con t r ols” on pa ge 5-31 for det a ils on u sin g t h e zoom con t r ols in t h e
F ilt er Viewer .
Help Button
To u se con t ext -sen sit ive h elp, pr ess t h e He lp bu t t on . Th e m ou se poin t er
becom es a n a r r ow wit h a qu est ion m a r k sym bol. You ca n t h en click on a n yt h in g
5-87
5 Interactive Tools
You ca n exper im en t t o fin d t h e t ilin g opt ion t h a t wor ks best for ea ch specific
com bin a t ion a n d n u m ber of su bplot s.
You ca n zoom in on a su bplot by pr essin g Mo u s e Zo o m a n d t h en clickin g on or
dr a ggin g over a select ed a r ea of t h e su bplot . By defa u lt , m ou se zoom in g in t h e
F ilt er Viewer is n ot per sist en t ; a ft er you click on ce, t h e zoom m ode is t u r n ed
off. You ca n m a ke zoom in g per sist en t by ch eckin g S ta y in Zo o m -m o d e a fte r
5-88
Using the Filter Viewer: Interactive Filter Analysis
5-89
5 Interactive Tools
5-90
Using the Filter Viewer: Interactive Filter Analysis
By defa u lt , t h is plot u ses t h e defa u lt sca lin g (lin e a r ) for bot h a xes a n d t h e
defa u lt r a n ge for t h e fr equ en cy a xis.
You ca n ch a n ge t h e followin g displa y ch a r a ct er ist ics of t h e m a gn it u de plot :
5-91
5 Interactive Tools
5-92
Using the Filter Viewer: Interactive Filter Analysis
5-93
5 Interactive Tools
5-94
Using the Filter Viewer: Interactive Filter Analysis
5-95
5 Interactive Tools
5-96
Using the Spectrum Viewer: Interactive PSD Analysis
5-97
5 Interactive Tools
Zoom controls
Signal ID
Parameters panel
5-98
Using the Spectrum Viewer: Interactive PSD Analysis
Menus
5-99
5 Interactive Tools
Signal ID Panel
Th is pa n el displa ys in for m a t ion a bou t t h e sign a l lin ked t o t h e cu r r en t ly
select ed spect r u m . Th e in for m a t ion in clu des t h e sign a l’s n a m e, size, da t a t ype
(real or complex), a n d sa m plin g fr equ en cy. To ch a n ge a n y of t h ese sign a l
pr oper t ies, u se SP Tool.
To a ssocia t e a com plet ely n ew sign a l wit h a displa yed spect r u m , select t h e
sign a l in SP Tool a n d pr ess U p d a te in t h e S p e c tra pa n el.
5-100
Using the Spectrum Viewer: Interactive PSD Analysis
Zoom Controls
Th e a va ila ble zoom con t r ols in t h e Spect r u m Viewer a r e Mo u s e Zo o m , F u ll
Vie w , Zo o m In -Y, Zo o m Ou t-Y, Zo o m In -X, a n d Zo o m Ou t-X. See “Zoom
Con t r ols” on pa ge 5-31 for det a ils on u sin g t h e zoom con t r ols in t h e Spect r u m
Viewer .
Help Button
To u se con t ext -sen sit ive h elp, pr ess t h e He lp bu t t on . Th e m ou se poin t er
becom es a n a r r ow wit h a qu est ion m a r k sym bol. You ca n t h en click on a n yt h in g
in t h e Spect r u m Viewer , in clu din g m en u it em s, t o fin d ou t wh a t it is a n d h ow
t o u se it .
5-101
5 Interactive Tools
5-102
Using the Spectrum Viewer: Interactive PSD Analysis
5-103
5 Interactive Tools
5-104
Using the Spectrum Viewer: Interactive PSD Analysis
5-105
5 Interactive Tools
• We ig h ts
Select on e of t h e followin g fr om t h e pop-u p m en u :
- adapt
- u n ity
- e ig e n
• Co n f. In t.
Ch eck t o com pu t e a con fiden ce in t er va l a n d t ype in a va lu e (see “Set t in g
Con fiden ce In t er va ls” on pa ge 5-107).
5-106
Using the Spectrum Viewer: Interactive PSD Analysis
• Co n f. In t.
Ch eck t o com pu t e a con fiden ce in t er va l a n d t ype in a va lu e (see “Set t in g
Con fiden ce In t er va ls” on pa ge 5-107).
3 P r ess Ap p ly .
NOTE Con fiden ce in t er va ls a r e r elia ble on ly for n on over la ppin g sect ion s.
5-107
5 Interactive Tools
5-108
Using the Spectrum Viewer: Interactive PSD Analysis
5-109
5 Interactive Tools
5-110
Using the Spectrum Viewer: Interactive PSD Analysis
Field Description
5-111
5 Interactive Tools
5-112
Example: Generation of Bandlimited Noise
x = randn(5000,1);
5-113
5 Interactive Tools
a Ma ke su r e t h a t S i g n a l is select ed in t h e Im p o rt As pop-u p m en u .
e P r ess OK .
5-114
Example: Generation of Bandlimited Noise
Design a Filter
You ca n im por t a n exist in g filt er in t o SP Tool, or you ca n design a n d edit a n ew
filt er u sin g t h e F ilt er Design er . In t h is st ep, you ’ll cr ea t e a defa u lt filt er a n d
cu st om ize it in t h e F ilt er Design er .
Th e F ilt er Design er win dow is displa yed wit h t h e defa u lt filt er filt1.
b Select ba n d p a s s fr om t h e Ty p e pop-u p m en u .
5-115
5 Interactive Tools
5-116
Example: Generation of Bandlimited Noise
5 P r ess OK .
5-117
5 Interactive Tools
5-118
Example: Generation of Bandlimited Noise
5-119
5 Interactive Tools
5-120
Example: Generation of Bandlimited Noise
Not ice t h a t t h e spect r u m ’s sign a l iden t ifica t ion in for m a t ion – in clu din g it s
n a m e, it s t ype, a n d it s sa m plin g fr equ en cy – is displa yed a bove t h e
P a ra m e te rs pa n el, a n d t h e spect r u m ’s n a m e is displa yed bot h a bove t h e
m a in a xes displa y a r ea a n d in t h e S e le c tio n pop-u p m en u .
5-121
5 Interactive Tools
5-122
Example: Generation of Bandlimited Noise
5-123
5 Interactive Tools
Tra c k t o Ve rtic a l . (See “Ru ler Con t r ols” on pa ge 5-33 for det a ils on u sin g
t h ese con t r ols.)
5-124
6
Refer en ce
6 Reference
6-2
Filter Analysis and Implementation
ac2poly Con ver sion of a u t ocor r ela t ion sequ en ce t o pr edict ion
polyn om ia l.
ac2rc Con ver sion of a u t ocor r ela t ion sequ en ce t o r eflect ion
coefficien t s.
convmtx Con volu t ion m a t r ix.
latc2tf La t t ice filt er t o t r a n sfer fu n ct ion con ver sion .
6-3
6 Reference
poly2ac Con ver sion of pr edict ion polyn om ia l t o a u t ocor r ela t ion
sequ en ce.
poly2rc Con ver sion of pr edict ion polyn om ia l t o r eflect ion
coefficien t s.
rc2ac Con ver sion of r eflect ion coefficien t s t o a u t ocor r ela t ion
sequ en ce.
rc2poly Con ver sion of r eflect ion coefficien t s t o pr edict ion
polyn om ia l.
residuez z-t r a n sfor m pa r t ia l-fr a ct ion expa n sion .
sos2ss Con ver sion of secon d-or der sect ion s t o st a t e-spa ce.
sos2tf Con ver sion of secon d-or der sect ion s t o t r a n sfer fu n ct ion .
sos2zp Con ver sion of secon d-or der sect ion s t o zer o-pole-ga in .
ss2sos Con ver sion of st a t e-spa ce t o secon d-or der sect ion s.
ss2tf Con ver sion of st a t e-spa ce t o t r a n sfer fu n ct ion .
ss2zp Con ver sion of st a t e-spa ce t o zer o-pole-ga in .
tf2latc Con ver sion of t r a n sfer fu n ct ion t o la t t ice filt er.
tf2sos Con ver sion of t r a n sfer fu n ct ion t o secon d-or der sect ion s.
tf2ss Con ver sion of t r a n sfer fu n ct ion t o st a t e-spa ce.
tf2zp Con ver sion of t r a n sfer fu n ct ion t o zer o-pole-ga in .
zp2sos Con ver sion of zer o-pole-ga in t o secon d-or der sect ion s.
zp2ss Con ver sion of zer o-pole-ga in t o st a t e-spa ce.
zp2tf Con ver sion of zer o-pole-ga in t o t r a n sfer fu n ct ion .
6-4
IIR Filter Design—Classical and Direct
6-5
6 Reference
Transforms
6-6
Statistical Signal Processing
6-7
6 Reference
Windows
Parametric Modeling
6-8
Parametric Modeling
Specialized Operations
6-9
6 Reference
Specialized Operations
Frequency Translation
6-10
Filter Discretization
Interactive Tools
6-11
abs
Purpose 6a bs
Absolu t e va lu e (m a gn it u de).
Syntax y = abs(x)
P lot t h e m a gn it u de:
f = (0:length(y)–1)'/length(y)*100; % frequency vector
plot(f,m)
6-12
ac2poly
Purpose 6a c2poly
Con ver sion of a u t ocor r ela t ion sequ en ce t o pr edict ion polyn om ia l.
Syntax a = ac2poly(r)
[a,efinal] = ac2poly(r)
a =
See Also ac2rc Con ver sion of a u t ocor r ela t ion sequ en ce t o r eflect ion
coefficien t s.
poly2ac Con ver sion of pr edict ion polyn om ia l t o
a u t ocor r ela t ion sequ en ce.
rc2poly Con ver sion of pr edict ion polyn om ia l t o r eflect ion
coefficien t s.
6-13
ac2rc
Purpose 6a c2rc
Con ver sion of a u t ocor r ela t ion sequ en ce t o r eflect ion coefficien t s.
Description [k,r0] = ac2rc(r) fin ds t h e r eflect ion coefficien t s, k, cor r espon din g t o t h e
a u t ocor r ela t ion sequ en ce r. r0 con t a in s t h e zer o-la g a u t ocor r ela t ion .
See Also ac2poly Con ver sion of a u t ocor r ela t ion sequ en ce t o pr edict ion
polyn om ia l.
poly2rc Con ver sion of pr edict ion polyn om ia l t o r eflect ion
coefficien t s.
rc2ac Con ver sion of r eflect ion coefficien t s t o
a u t ocor r ela t ion sequ en ce.
6-14
angle
Purpose 6a n gle
P h a se a n gle.
Syntax p = angle(h)
P lot t h e ph a se:
f = (0:length(y)–1)'/length(y)*100; % frequency vector
plot(f,p)
6-15
arburg
Purpose 6a r bu r g
Com pu t e a n est im a t e of AR m odel pa r a m et er s u sin g t h e Bu r g m et h od.
Syntax a = arburg(x,p)
[a,e] = arburg(x,p)
[a,e,k] = arburg(x,p)
e e
H ( z ) = ------------ = ---------------------------------------------------------------------
-
A (z ) –1
1 + a 2 z + … + a (p + 1 )z
–p
6-16
arcov
Purpose 6a r cov
Com pu t e a n est im a t e of AR m odel pa r a m et er s u sin g t h e cova r ia n ce m et h od.
Syntax a = arcov(x,p)
[a,e] = arcov(x,p)
e e
H ( z ) = ------------ = ---------------------------------------------------------------------
–1 –p
-
A (z ) 1 + a 2 z + … + a (p + 1 )z
6-17
armcov
Purpose 6a r m cov
Com pu t e a n est im a t e of AR m odel pa r a m et er s u sin g t h e m odified cova r ia n ce
m et h od.
Syntax a = armcov(x,p)
[a,e] = armcov(x,p)
e e
H ( z ) = ------------ = ---------------------------------------------------------------------
-
A (z ) –1
1 + a 2 z + … + a (p + 1 )z
–p
6-18
aryule
Purpose 6a r yu le
Com pu t e a n est im a t e of AR m odel pa r a m et er s u sin g t h e Yu le-Wa lk er m et h od.
Syntax a = aryule(x,p)
[a,e] = aryule(x,p)
[a,e,k] = aryule(x,p)
e e
H ( z ) = ------------ = ---------------------------------------------------------------------
–1 –p
-
A (z ) 1 + a 2 z + … + a (p + 1 )z
6-19
bartlett
Syntax w = bartlett(n)
• F or n odd
⎧ 2--------------------
(k – 1 )
-,
n +1
1 ≤ k ≤ -------------
⎪ n – 1 2
w [ k ] = ⎨
⎪ 2 – 2--------------------
(k – 1 ) n +1
-, ------------- ≤ k ≤ n
⎩ n –1 2
• F or n even
⎧ 2--------------------
(k – 1 )
-,
n
1 ≤ k ≤ ---
⎪ n – 1 2
w [ k ] = ⎨
⎪ 2--------------------
(n – k )
-,
n
--- + 1 ≤ k ≤ n
⎩ n – 1 2
References [1] Oppen h eim , A.V., a n d R.W. Sch a fer . Discrete-T im e S ign al Processin g.
E n glewood Cliffs, NJ : P r en t ice-H a ll, 1989.
6-20
besselap
Purpose 6bessela p
Bessel a n a log lowpa ss filt er pr ot ot ype.
k
H (s ) = -----------------------------------------------------------------------------
( s – p (1 ) ) ( s – p (2 ) )Ls ( – p (n ) )
besselap n or m a lizes t h e poles a n d ga in so t h a t a t low fr equ en cy a n d h igh
fr equ en cy t h e Bessel pr ot ot ype is a sym pt ot ica lly equ iva len t t o t h e Bu t t er wor t h
pr ot ot ype of t h e sa m e or der [1]. Th e m a gn it u de of t h e filt er is less t h a n
sqrt(1/2) a t t h e u n it y cu t off fr equ en cy Ωc = 1.
( 2 n )!⎞ 1 ⁄n
⎛ -------------
-
⎝ 2 n n ! ⎠
6-21
besself
Purpose 6besself
Bessel a n a log filt er design .
Description besself design s lowpa ss, ba n dpa ss, h igh pa ss, a n d ba n dst op a n a log Bessel
filt er s. An a log Bessel filt er s a r e ch a r a ct er ized by a lm ost con st a n t gr ou p dela y
a cr oss t h e en t ir e pa ssba n d, t h u s pr eser vin g t h e wa ve sh a pe of filt er ed sign a ls
in t h e pa ssba n d. Digit a l Bessel filt er s do n ot r et a in t h is qu a lit y, a n d besself
t h er efor e does n ot su ppor t t h e design of digit a l Bessel filt er s.
B (s ) b (1 )s n + b (2 )s n – 1 + L+ b (n + 1 )
H (s ) = ----------- = ---------------------------------------------------------------------------------
-
A (s ) s n + a (2 )s n –1 + L+ a (n + 1 )
Cu toff frequ en cy is t h e fr equ en cy a t wh ich t h e m a gn it u de r espon se of t h e filt er
begin s t o decr ea se sign ifica n t ly. F or besself, t h e cu t off fr equ en cy Wn m u st be
gr ea t er t h a n 0. Th e m a gn it u de r espon se of a Bessel filt er design ed by besself
is a lwa ys less t h a n sqrt(1/2) a t t h e cu t off fr equ en cy, a n d it decr ea ses a s t h e
or der n in cr ea ses.
If Wn is a t wo-elem en t vect or , Wn = [w1 w2] wit h w1 < w2, besself(n,Wn)
r et u r n s a n or der 2*n ba n dpa ss a n a log filt er wit h pa ssba n d w1 < ω < w2.
6-22
besself
[z,p,k] = besself(n,Wn) or
[z,p,k] = besself(n,Wn,'ftype')
[A,B,C,D] = besself(n,Wn) or
[A,B,C,D] = besself(n,Wn,'ftype') wh er e A, B, C, a n d D a r e
·
x = Ax + Bu
y = Cx + Du
a n d u is t h e in pu t , x is t h e st a t e vect or , a n d y is t h e ou t pu t .
Example Design a fift h -or der a n a log lowpa ss Bessel filt er t h a t su ppr esses fr equ en cies
gr ea t er t h a n 10,000 r a d/sec a n d plot t h e fr equ en cy r espon se of t h e filt er u sin g
freqs:
[b,a] = besself(5,10000);
freqs(b,a) % plot frequency response
Frequency Response
0
10
Magnitude
-5
10 2 3 4 5
10 10 10 10
Frequency (radians)
200
Phase (degrees)
-200 2 3 4 5
10 10 10 10
Frequency (radians)
6-23
besself
Limitations Lowpa ss Bessel filt er s h a ve a m on ot on ica lly decr ea sin g m a gn it u de r espon se,
a s do lowpa ss Bu t t er wor t h filt er s. Com pa r ed t o t h e Bu t t er wor t h , Ch ebysh ev,
a n d ellipt ic filt er s, t h e Bessel filt er h a s t h e slowest r olloff a n d r equ ir es t h e
h igh est or der t o m eet a n a t t en u a t ion specifica t ion .
F or h igh or der filt er s, t h e st a t e-spa ce for m is t h e m ost n u m er ica lly a ccu r a t e,
followed by t h e zer o-pole-ga in for m . Th e t r a n sfer fu n ct ion coefficien t for m is
t h e lea st a ccu r a t e; n u m er ica l pr oblem s ca n a r ise for filt er or der s a s low a s 15.
6-24
bilinear
Purpose 6bilin ea r
Bilin ea r t r a n sfor m a t ion m et h od of a n a log-t o-digit a l filt er con ver sion .
Description Th e bilin ear tran sform ation is a m a t h em a t ica l m a ppin g of va r ia bles. In digit a l
filt er in g, it is a st a n da r d m et h od of m a ppin g t h e s or a n a log pla n e in t o t h e z or
digit a l pla n e. It t r a n sfor m s a n a log filt er s, design ed u sin g cla ssica l filt er design
t ech n iqu es, in t o t h eir discr et e equ iva len t s.
Th e bilin ea r t r a n sfor m a t ion m a ps t h e s-pla n e in t o t h e z-pla n e by
H (z ) = H (s ) z –1
s = 2 f s ------------
z +1
Ω
ω = 2 t a n – 1 ⎛ --------⎞
⎝ 2 f s ⎠
H (z ) = H (s ) 2 πf p ( z – 1 )
s = ------------------------ -----------------
f p (z + 1 )
t a n ⎛ π ----⎞
⎝ f s ⎠
6-25
bilinear
f
⎛ Ω t a n ⎛ π ----p ⎞ ⎞
⎜ ⎝ f s ⎠ ⎟
ω = 2 t a n – 1 ⎜ -----------------------------⎟
⎜ 2 πf p ⎟
⎝ ⎠
Zero-Pole-Gain
[zd,pd,kd] = bilinear(z,p,k,Fs) a n d
Transfer Function
[numd,dend] = bilinear(num,den,Fs) a n d
n u m (s ) n u m (1 )s n n + L+ n u m (n n )s + n u m (n n + 1 )
-------------------- = ------------------------------------------------------------------------------------------------------------------
-
d en (s ) d en (1 )s n d + L+ d en (n d )s + d en (n d + 1 )
6-26
bilinear
State-Space
[Ad,Bd,Cd,Dd] = bilinear(A,B,C,D,Fs) a n d
x [n + 1 ] = A d x [n ] + B d u [n ]
y [n ] = C d x [n ] + Dd u [n ]
Zero-Pole-Gain Algorithm
F or a syst em in zer o-pole-ga in for m , bilinear per for m s fou r st eps:
6-27
bilinear
State-Space Algorithm
F or a syst em in st a t e-spa ce for m , bilinear per for m s t wo st eps:
1 1 –1
A d = ⎛ I + ⎛ ---⎞ A ⎞ ⎛ I – ⎛ ---⎞ A ⎞
⎝ ⎝ k ⎠ ⎠ ⎝ ⎝ k ⎠ ⎠
2k 1 –1
B d = ------- ⎛⎝ I – ⎛⎝ ---⎞⎠ A ⎞⎠ B
r k
1 –1
C d = r C ⎛ I – ⎛ ---⎞ A ⎞
⎝ ⎝ k ⎠ ⎠
1 1 –1
D d = ⎛ ---⎞ C ⎛ I – ⎛ ---⎞ A ⎞ B + D
⎝ k ⎠ ⎝ ⎝ k ⎠ ⎠
bilinear im plem en t s t h ese r ela t ion s u sin g con ven t ion a l MATLAB
st a t em en t s. Th e sca la r r is a r bit r a r y; bilinear u ses sqrt(2/k) t o en su r e good
qu a n t iza t ion n oise pr oper t ies in t h e r esu lt in g syst em .
6-28
bilinear
References [1] P a r ks, T.W., a n d C.S. Bu r r u s. Digital Filter Design . New Yor k: J oh n Wiley
& Son s, 1987. P gs. 209-213.
[2] Oppen h eim , A.V., a n d R.W. Sch a fer . Discrete-T im e S ign al Processin g.
E n glewood Cliffs, NJ : P r en t ice-H a ll, 1989. P gs. 415-430.
6-29
blackman
Purpose 6bla ck m a n
Bla ckm a n win dow.
Syntax w = blackman(n)
w = blackman(n,sflag)
k –1 k –1
w [ k ] = 0.42 – 0.5 cos ⎛ 2 π -------------⎞ + 0.08 cos ⎛ 4 π -------------⎞ , k = 1 , …, n
⎝ n – 1 ⎠ ⎝ n – 1 ⎠
Bla ckm a n win dows h a ve sligh t ly wider cen t r a l lobes a n d less sideba n d lea k a ge
t h a n equ iva len t len gt h H a m m in g a n d H a n n in g win dows.
6-30
blackman
References [1] Oppen h eim , A.V., a n d R.W. Sch a fer . Discrete-T im e S ign al Processin g.
E n glewood Cliffs, NJ : P r en t ice-H a ll, 1989.
6-31
boxcar
Purpose 6boxca r
Rect a n gu la r win dow.
Syntax w = boxcar(n)
Algorithm w = ones(n,1);
References [1] Oppen h eim , A.V., a n d R.W. Sch a fer . Discrete-T im e S ign al Processin g.
E n glewood Cliffs, NJ : P r en t ice-H a ll, 1989.
6-32
buffer
Syntax y = buffer(x,n)
y = buffer(x,n,p)
y = buffer(x,n,p,opt)
[y,z] = buffer(...)
[y,z,opt] = buffer(...)
y =
0 2 6 10 14 18 22 26
0 3 7 11 15 19 23 27
0 4 8 12 16 20 24 28
1 5 9 13 17 21 25 29
2 6 10 14 18 22 26 30
3 7 11 15 19 23 27 0
4 8 12 16 20 24 28 0
6-33
buffer
• F or p< 0 (u n der la p), buffer skips p sa m ples bet ween con secu t ive fr a m es. F or
exa m ple, if x=1:30 a n d n=7, a bu ffer wit h u n der la p of p=–3 looks lik e t h is:
y =
1 11 21
2 12 22
3 13 23 8 18 28
4 14 24 skipped 9 19 29
5 15 25 10 20 30
6 16 26
7 17 27
• F or 0< p< n (over la p), opt specifies a len gt h -p vect or t o in ser t befor e x(1) in
t h e bu ffer . Th is vect or ca n be con sider ed a n in itial con d ition , wh ich is n eeded
wh en t h e cu r r en t bu ffer in g oper a t ion is on e in a sequ en ce of con secu t ive
bu ffer in g oper a t ion s. To m a in t a in t h e desir ed fr a m e over la p fr om on e bu ffer
t o t h e n ext , opt sh ou ld con t a in t h e fin a l p sa m ples of t h e pr eviou s bu ffer in
t h e sequ en ce. See “Con t in u ou s Bu ffer in g” below.
• By defa u lt , opt is zeros(p,1) for a n over la ppin g bu ffer . Set opt t o
'nodelay' t o sk ip t h e in it ia l con dit ion a n d begin fillin g t h e bu ffer
im m edia t ely wit h x(1). In t h is ca se, L m u st be length(p) or lon ger . F or
exa m ple, if x=1:30 a n d n=7, a bu ffer wit h over la p of p=3 look s like t h is:
y =
1 5 9 13 17 21 25
2 6 10 14 18 22 26
3 7 11 15 19 23 27
4 8 12 16 20 24 28
5 9 13 17 21 25 29
6 10 14 18 22 26 30
7 11 15 19 23 27 0
6-34
buffer
or
m = floor((L–n)/(n–p))+1 % when opt = 'nodelay'
or
length(z) = L – ((m–1)*(n–p)+n) % when opt = 'nodelay'
6-35
buffer
6-36
buffer
Continuous Buffering
In a con t in u ou s bu ffer in g oper a t ion , t h e vect or in pu t t o t h e buffer fu n ct ion
r epr esen t s on e fr a m e in a sequ en ce of fr a m es t h a t m a k e u p a discr et e sign a l.
Th ese sign a l fr a m es ca n or igin a t e in a fr a m e-ba sed da t a a cqu isit ion pr ocess, or
wit h in a fr a m e-ba sed a lgor it h m lik e t h e F F T.
As a n exa m ple, you m igh t a cqu ir e da t a fr om a n A/D ca r d in fr a m es of 64
sa m ples. In t h e sim plest ca se, you cou ld r ebu ffer t h e da t a in t o fr a m es of 16
sa m ples; buffer wit h n= 16 cr ea t es a bu ffer of fou r fr a m es fr om ea ch
64-elem en t in pu t fr a m e. Th e r esu lt is t h a t t h e sign a l of fr a m e size 64 h a s been
con ver t ed t o a sign a l of fr a m e size 16; n o sa m ples wer e a dded or r em oved.
In t h e gen er a l ca se wh er e t h e or igin a l sign a l fr a m e size, L, is n ot equ a lly
divisible by t h e n ew fr a m e size, n, t h e over flow fr om t h e la st fr a m e n eeds t o be
ca pt u r ed a n d r ecycled in t o t h e followin g bu ffer . You ca n do t h is by it er a t ively
ca llin g buffer on in pu t x wit h t h e t wo-ou t pu t -a r gu m en t syn t a x:
[y,z] = buffer([z;x],n) % for column vector x
6-37
buffer
[y,z,opt] = buffer([z;x],n,p,opt);
6-38
buffer
Iteration Input frame [z;x]' opt (input) opt (output) Output buffer (y) Overflow (z)
–5 3 6
1 4 7
i=1 [1:11] –5 9 [10 11]
2 5 8
3 6 9
9 12 15 18
10 13 16 19
i=2 [10 11 12:22] 9 21 [22]
11 14 17 20
12 15 18 21
21 24 27 30
22 25 28 31
i=3 [22 23:33] 21 33 []
23 26 29 32
24 27 30 33
33 36 39
i=4 34 37 40
[34:44] 33 42 [43 44]
35 38 41
36 39 42
6-39
buffer
Set t h e bu ffer pa r a m et er s:
n = 4; % new frame size
p = –2; % underlap
opt = 1; % skip the first input element, x(1)
z = []; % initialize the carry-over vector
[y,z,opt] = buffer([z;x],n,p,opt);
6-40
buffer
Iteration Input frame [z;x]' opt (input) opt (output) Output buffer (y) Overflow (z)
1 – skip
2 8
3 9
i=1 [1:11] 1 2 4 10 []
5 11
6 –
skip
7 –
12 skip
13
14
15
i=2 [12:22] 2 0 [20 21 22]
16
17
18
skip
19
– – skip
20 26
21 27
i=3 [20 21 22 23:33] 0 0 22 28 [32 33]
23 29
24 30 skip
25 31
6-41
buttap
Purpose 6bu t ta p
Bu t t er wor t h a n a log lowpa ss filt er pr ot ot ype.
z (s ) k
H (s ) = ---------- = -----------------------------------------------------------------------------
p (s ) ( s – p (1 ) ) ( s – p (2 ) )Ls ( – p (n ) )
Bu t t er wor t h filt er s a r e ch a r a ct er ized by a m a gn it u de r espon se t h a t is
m a xim a lly fla t in t h e pa ssba n d a n d m on ot on ic over a ll. In t h e lowpa ss ca se, t h e
fir st 2 n–1 der iva t ives of t h e squ a r ed m a gn it u de r espon se a r e zer o a t ω = 0. Th e
squ a r ed m a gn it u de r espon se fu n ct ion is
2 1
H ( ω) = -----------------------------------
-
1 + ( ω ⁄ ω0 ) 2 n
cor r espon din g t o a t r a n sfer fu n ct ion wit h poles equ a lly spa ced a r ou n d a cir cle
in t h e left h a lf pla n e. Th e m a gn it u de r espon se a t t h e cu t off fr equ en cy ω0 is
a lwa ys 1/sqrt(2), r ega r dless of t h e filt er or der . buttap set s ω0 t o 1 for a
n or m a lized r esu lt .
Algorithm z = [];
p = exp(sqrt(–1)*(pi*(1:2:2*n–1)/(2*n)+pi/2)).';
k = real(prod(–p));
References [1] P a r ks, T.W., a n d C.S. Bu r r u s. Digital Filter Design . New Yor k: J oh n Wiley
& Son s, 1987. Ch a pt er 7.
6-42
butter
Purpose 6bu t t er
Bu t t er wor t h a n a log a n d digit a l filt er design .
Description butter design s lowpa ss, ba n dpa ss, h igh pa ss, a n d ba n dst op digit a l a n d a n a log
Bu t t er wor t h filt er s. Bu t t er wor t h filt er s a r e ch a r a ct er ized by a m a gn it u de
r espon se t h a t is m a xim a lly fla t in t h e pa ssba n d a n d m on ot on ic over a ll.
Bu t t er wor t h filt er s sa cr ifice r olloff st eepn ess for m on ot on icit y in t h e pa ss- a n d
st opba n ds. Un less t h e sm oot h n ess of t h e Bu t t er wor t h filt er is n eeded, a n
ellipt ic or Ch ebysh ev filt er ca n gen er a lly pr ovide st eeper r olloff ch a r a ct er ist ics
wit h a lower filt er or der .
Digital Domain
B (z ) b (1 ) + b (2 )z – 1 + L+ b (n + 1 )z – n
H (z ) = ----------- = ---------------------------------------------------------------------------------
A (z ) 1 + a (2 )z – 1 + L+ a (n + 1 )z – n
Cu toff frequ en cy is t h a t fr equ en cy wh er e t h e m a gn it u de r espon se of t h e filt er
is sqrt(1/2). F or butter, t h e cu t off fr equ en cy Wn m u st be a n u m ber bet ween 0
a n d 1, wh er e 1 cor r espon ds t o h a lf t h e sa m plin g fr equ en cy (t h e Nyqu ist
fr equ en cy).
If Wn is a t wo-elem en t vect or , Wn = [w1 w2], butter r et u r n s a n or der 2*n digit a l
ba n dpa ss filt er wit h pa ssba n d w1 < ω < w2.
6-43
butter
[z,p,k] = butter(n,Wn) or
[z,p,k] = butter(n,Wn,'ftype')
[A,B,C,D] = butter(n,Wn) or
[A,B,C,D] = butter(n,Wn,'ftype') wh er e A, B, C, a n d D a r e
x [n + 1 ] = A x [n ] + B u [n ]
y [n ] = C x [n ] + D u [n ]
a n d u is t h e in pu t , x is t h e st a t e vect or , a n d y is t h e ou t pu t .
Analog Domain
B (s ) b (1 )s n + b (2 )s n – 1 + L+ b (n + 1 )
H (s ) = ----------- = ---------------------------------------------------------------------------------
-
A (s ) s n + a (2 )s n –1 + L+ a (n + 1 )
butter’s cu t off fr equ en cy Wn m u st be gr ea t er t h a n 0.
6-44
butter
[z,p,k] = butter(n,Wn,'s') or
[A,B,C,D] = butter(n,Wn,'s') or
[A,B,C,D] = butter(n,Wn,'ftype','s') wh er e A, B, C, a n d D a r e
·
x = Ax + Bu
y = Cx + Du
a n d u is t h e in pu t , x is t h e st a t e vect or , a n d y is t h e ou t pu t .
6-45
butter
0
Magnitude (dB)
−100
−200
−300
−400
0 100 200 300 400 500
Frequency (Hz)
200
Phase (degrees)
−200
−400
−600
−800
0 100 200 300 400 500
Frequency (Hz)
Design a 10t h -or der ba n dpa ss Bu t t er wor t h filt er wit h a pa ssba n d fr om 100 t o
200 H z a n d plot it s im pu lse r espon se, or u n it sam ple respon se:
n = 5; Wn = [100 200]/500;
[b,a] = butter(n,Wn);
[y,t] = impz(b,a,101);
stem(t,y)
0.2
0.15
0.1
0.05
-0.05
-0.1
-0.15
-0.2
-0.25
0 10 20 30 40 50 60 70 80 90 100
6-46
butter
Limitations F or h igh or der filt er s, t h e st a t e-spa ce for m is t h e m ost n u m er ica lly a ccu r a t e,
followed by t h e zer o-pole-ga in for m . Th e t r a n sfer fu n ct ion coefficien t for m is
t h e lea st a ccu r a t e; n u m er ica l pr oblem s ca n a r ise for filt er or der s a s low a s 15.
6-47
buttord
Digital Domain
6-48
buttord
Analog Domain
n =
4
Wn =
0.2042
[b,a] = butter(n,Wn);
freqz(b,a,512,1000); title('n=4 Butterworth Lowpass Filter')
-100
-200
-300
0 50 100 150 200 250 300 350 400 450 500
Frequency (Hertz)
0
Phase (degrees)
-100
-200
-300
-400
0 50 100 150 200 250 300 350 400 450 500
Frequency (Hertz)
6-49
buttord
100
Magnitude Response (dB)
-100
-200
-300
0 50 100 150 200 250 300 350 400 450 500
Frequency (Hertz)
500
Phase (degrees)
-500
-1000
0 50 100 150 200 250 300 350 400 450 500
Frequency (Hertz)
Algorithm buttord’s or der pr edict ion for m u la is descr ibed in [1]. It oper a t es in t h e a n a log
dom a in for bot h a n a log a n d digit a l ca ses. F or t h e digit a l ca se, it con ver t s t h e
fr equ en cy pa r a m et er s t o t h e s-dom a in befor e est im a t in g t h e or der a n d n a t u r a l
fr equ en cy, t h en con ver t s ba ck t o t h e z-dom a in .
buttord in it ia lly develops a lowpa ss filt er pr ot ot ype by t r a n sfor m in g t h e
pa ssba n d fr equ en cies of t h e desir ed filt er t o 1 r a d/sec (for low- a n d h igh pa ss
filt er s) a n d t o -1 a n d 1 r a d/sec (for ba n dpa ss a n d ba n dst op filt er s). It t h en
com pu t es t h e m in im u m or der r equ ir ed for a lowpa ss filt er t o m eet t h e st opba n d
specifica t ion .
6-50
buttord
6-51
cceps
Purpose 6cceps
Com plex cepst r a l a n a lysis.
Algorithm cceps, in it s ba sic for m , is a n M-file im plem en t a t ion of a lgor it h m 7.1 in [2]. A
len gt h y F or t r a n pr ogr a m r edu ces t o t h r ee lin es of MATLAB code:
h = fft(x);
logh = log(abs(h)) + sqrt(–1)*rcunwrap(angle(h));
y = real(ifft(logh));
6-52
cceps
References [1] Oppen h eim , A.V., a n d R.W. Sch a fer . Discrete-T im e S ign al Processin g.
E n glewood Cliffs, NJ : P r en t ice-H a ll, 1989.
[2] IE E E . Program s for Digital S ign al Processin g. IE E E P r ess. New Yor k: J oh n
Wiley & Son s, 1979.
6-53
cheb1ap
z (s ) k
H (s ) = ---------- = -----------------------------------------------------------------------------
p (s ) ( s – p (1 ) ) ( s – p (2 ) )Ls ( – p (n ) )
Ch ebysh ev t ype I filt er s a r e equ ir ipple in t h e pa ssba n d a n d m on ot on ic in t h e
st opba n d. Th e poles a r e even ly spa ced a bou t a n ellipse in t h e left h a lf pla n e.
Th e Ch ebysh ev t ype I cu t off fr equ en cy ω 0 is set t o 1.0 for a n or m a lized r esu lt .
Th is is t h e fr equ en cy a t wh ich t h e pa ssba n d en ds a n d t h e filt er h a s m a gn it u de
r espon se of 10 -Rp/20 .
References [1] P a r ks, T.W., a n d C.S. Bu r r u s. Digital Filter Design . New Yor k: J oh n Wiley
& Son s, 1987. Ch a pt er 7.
6-54
cheb1ord
Digital Domain
6-55
cheb1ord
Analog Domain
n =
3
Wn =
0.2000
[b,a] = cheby1(n,Rp,Wn);
freqz(b,a,512,1000); title('n=3 Chebyshev Type I Lowpass Filter')
n = 3 Chebyshev Type I Lowpass Filter
50
Magnitude Response (dB)
-50
-100
-150
-200
0 50 100 150 200 250 300 350 400 450 500
Frequency (Hertz)
0
Phase (degrees)
-100
-200
-300
0 50 100 150 200 250 300 350 400 450 500
Frequency (Hertz)
6-56
cheb1ord
n =
4
Wn =
0.2000 0.4000
[b,a] = cheby1(n,Rp,Wn);
freqz(b,a,512,1000);
title('n=4 Chebyshev Type I Bandpass Filter')
n = 4 Chebyshev Type I Bandpass Filter
0
Magnitude Response (dB)
-100
-200
-300
0 50 100 150 200 250 300 350 400 450 500
Frequency (Hertz)
0
Phase (degrees)
-200
-400
-600
-800
0 50 100 150 200 250 300 350 400 450 500
Frequency (Hertz)
Algorithm cheb1ord u ses t h e Ch ebysh ev lowpa ss filt er or der pr edict ion for m u la descr ibed
in [1]. Th e fu n ct ion per for m s it s ca lcu la t ion s in t h e a n a log dom a in for bot h
a n a log a n d digit a l ca ses. F or t h e digit a l ca se, it con ver t s t h e fr equ en cy
pa r a m et er s t o t h e s-dom a in befor e t h e or der a n d n a t u r a l fr equ en cy est im a t ion
pr ocess, t h en con ver t s t h em ba ck t o t h e z-dom a in .
6-57
cheb1ord
6-58
cheb2ap
z (s ) ( s – z (1 ) ) ( s – z (2 ) )Ls ( – z (n ) )
H (s ) = ---------- = k -----------------------------------------------------------------------------
p (s ) ( s – p (1 ) ) ( s – p (2 ) )Ls ( – p (n ) )
Ch ebysh ev t ype II filt er s a r e m on ot on ic in t h e pa ssba n d a n d equ ir ipple in t h e
st opba n d. Th e pole loca t ion s a r e t h e in ver se of t h e pole loca t ion s of cheb1ap,
wh ose poles a r e even ly spa ced a bou t a n ellipse in t h e left h a lf pla n e. Th e
Ch ebysh ev t ype II cu t off fr equ en cy ω0 is set t o 1 for a n or m a lized r esu lt . Th is
is t h e fr equ en cy a t wh ich t h e st opba n d begin s a n d t h e filt er h a s m a gn it u de
r espon se of 10 -Rs/20 .
References [1] P a r ks, T.W., a n d C.S. Bu r r u s. Digital Filter Design . New Yor k: J oh n Wiley
& Son s, 1987. Ch a pt er 7.
6-59
cheb2ord
Digital Domain
6-60
cheb2ord
Analog Domain
n =
3
Wn =
0.2609
[b,a] = cheby2(n,Rs,Wn);
freqz(b,a,512,1000);
title('n=3 Chebyshev Type II Lowpass Filter')
n = 3 Chebyshev Type II Lowpass Filter
20
Magnitude Response (dB)
-20
-40
-60
-80
0 50 100 150 200 250 300 350 400 450 500
Frequency (Hertz)
0
Phase (degrees)
-50
-100
-150
-200
0 50 100 150 200 250 300 350 400 450 500
Frequency (Hertz)
6-61
cheb2ord
n =
4
Wn =
0.1633 0.4665
[b,a] = cheby2(n,Rs,Wn);
freqz(b,a,512,1000)
title('n=4 Chebyshev Type II Bandpass Filter')
n = 4 Chebyshev Type II Bandpass Filter
0
Magnitude Response (dB)
-20
-40
-60
-80
0 50 100 150 200 250 300 350 400 450 500
Frequency (Hertz)
400
Phase (degrees)
200
-200
-400
0 50 100 150 200 250 300 350 400 450 500
Frequency (Hertz)
Algorithm cheb2ord u ses t h e Ch ebysh ev lowpa ss filt er or der pr edict ion for m u la descr ibed
in [1]. Th e fu n ct ion per for m s it s ca lcu la t ion s in t h e a n a log dom a in for bot h
a n a log a n d digit a l ca ses. F or t h e digit a l ca se, it con ver t s t h e fr equ en cy
pa r a m et er s t o t h e s-dom a in befor e t h e or der a n d n a t u r a l fr equ en cy est im a t ion
pr ocess, t h en con ver t s t h em ba ck t o t h e z-dom a in .
6-62
cheb2ord
6-63
chebwin
Syntax w = chebwin(n,r)
References [1] IE E E . Program s for Digital S ign al Processin g. IE E E P r ess. New Yor k: J oh n
Wiley & Son s, 1979. P r ogr a m 5.2.
6-64
cheby1
Description cheby1 design s lowpa ss, ba n dpa ss, h igh pa ss, a n d ba n dst op digit a l a n d a n a log
Ch ebysh ev t ype I filt er s. Ch ebysh ev t ype I filt er s a r e equ ir ipple in t h e
pa ssba n d a n d m on ot on ic in t h e st opba n d. Type I filt er s r oll off fa st er t h a n t ype
II filt er s, bu t a t t h e expen se of gr ea t er devia t ion fr om u n it y in t h e pa ssba n d.
Digital Domain
B (z ) b (1 ) + b (2 )z – 1 + L+ b (n + 1 )z – n
H (z ) = ----------- = ---------------------------------------------------------------------------------
A (z ) 1 + a (2 )z – 1 + L+ a (n + 1 )z – n
Cu toff frequ en cy is t h e fr equ en cy a t wh ich t h e m a gn it u de r espon se of t h e filt er
is equ a l t o –Rp dB. F or cheby1, t h e cu t off fr equ en cy Wn is a n u m ber bet ween 0
a n d 1, wh er e 1 cor r espon ds t o h a lf t h e sa m plin g fr equ en cy (t h e Nyqu ist
fr equ en cy). Sm a ller va lu es of pa ssba n d r ipple Rp lea d t o wider t r a n sit ion
widt h s (sh a llower r olloff ch a r a ct er ist ics).
If Wn is a t wo-elem en t vect or , Wn = [w1 w2], cheby1 r et u r n s a n or der 2*n
ba n dpa ss filt er wit h pa ssba n d w1 < ω < w2.
6-65
cheby1
[z,p,k] = cheby1(n,Rp,Wn) or
[A,B,C,D] = cheby1(n,Rp,Wn) or
[A,B,C,D] = cheby1(n,Rp,Wn,'ftype') wh er e A, B, C, a n d D a r e
x [n + 1 ] = A x [n ] + B u [n ]
y [n ] = C x [n ] + D u [n ]
a n d u is t h e in pu t , x is t h e st a t e vect or , a n d y is t h e ou t pu t .
Analog Domain
B (s ) b (1 )s n + b (2 )s n – 1 + L+ b (n + 1 )
H (s ) = ----------- = ---------------------------------------------------------------------------------
-
A (s ) s n + a (2 )s n –1 + L+ a (n + 1 )
Cu toff frequ en cy is t h e fr equ en cy a t wh ich t h e m a gn it u de r espon se of t h e filt er
is –Rp dB. F or cheby1, t h e cu t off fr equ en cy Wn m u st be gr ea t er t h a n 0.
If Wn is a t wo-elem en t vect or , Wn = [w1 w2], wit h w1 < w2, t h en
cheby1(n,Rp,Wn,'s') r et u r n s a n or der 2*n ba n dpa ss a n a log filt er wit h
pa ssba n d w1 < ω < w2.
6-66
cheby1
[z,p,k] = cheby1(n,Rp,Wn,'s') or
[A,B,C,D] = cheby1(n,Rp,Wn,'s') or
6-67
cheby1
-100
-200
-300
0 50 100 150 200 250 300 350 400 450 500
Frequency (Hertz)
-200
Phase (degrees)
-400
-600
-800
-1000
0 50 100 150 200 250 300 350 400 450 500
Frequency (Hertz)
Design a 10t h -or der ba n dpa ss Ch ebysh ev t ype I filt er wit h a pa ssba n d fr om
100 t o 200 H z a n d plot it s im pu lse r espon se:
n = 10; Rp = 0.5;
Wn = [100 200]/500;
[b,a] = cheby1(n,Rp,Wn);
[y,t] = impz(b,a,101); stem(t,y)
Impulse Response of n = 10 Chebyshev Type I Filter
0.15
0.1
0.05
-0.05
-0.1
-0.15
-0.2
0 10 20 30 40 50 60 70 80 90 100
6-68
cheby1
Limitations F or h igh or der filt er s, t h e st a t e-spa ce for m is t h e m ost n u m er ica lly a ccu r a t e,
followed by t h e zer o-pole-ga in for m . Th e t r a n sfer fu n ct ion for m is t h e lea st
a ccu r a t e; n u m er ica l pr oblem s ca n a r ise for filt er or der s a s low a s 15.
6-69
cheby2
Description cheby2 design s lowpa ss, h igh pa ss, ba n dpa ss, a n d ba n dst op digit a l a n d a n a log
Ch ebysh ev t ype II filt er s. Ch ebysh ev t ype II filt er s a r e m on ot on ic in t h e
pa ssba n d a n d equ ir ipple in t h e st opba n d. Type II filt er s do n ot r oll off a s fa st
a s t ype I filt er s, bu t a r e fr ee of pa ssba n d r ipple.
Digital Domain
B (z ) b (1 ) + b (2 )z – 1 + L+ b (n + 1 )z – n
H (z ) = ----------- = ---------------------------------------------------------------------------------
A (z ) 1 + a (2 )z – 1 + L+ a (n + 1 )z – n
Cu toff frequ en cy is t h e begin n in g of t h e st opba n d, wh er e t h e m a gn it u de
r espon se of t h e filt er is equ a l t o –Rs dB. F or cheby2, t h e cu t off fr equ en cy Wn is
a n u m ber bet ween 0 a n d 1, wh er e 1 cor r espon ds t o h a lf t h e sa m plin g fr equ en cy
(t h e Nyqu ist fr equ en cy). La r ger va lu es of st opba n d a t t en u a t ion Rs lea d t o
wider t r a n sit ion widt h s (sh a llower r olloff ch a r a ct er ist ics).
If Wn is a t wo-elem en t vect or , Wn = [w1 w2], cheby2 r et u r n s a n or der 2*n
ba n dpa ss filt er wit h pa ssba n d w1 < ω < w2.
6-70
cheby2
[z,p,k] = cheby2(n,Rs,Wn) or
[A,B,C,D] = cheby2(n,Rs,Wn) or
[A,B,C,D] = cheby2(n,Rs,Wn,'ftype') wh er e A, B, C, a n d D a r e
x [n + 1 ] = A x [n ] + B u [n ]
y [n ] = C x [n ] + D u [n ]
a n d u is t h e in pu t , x is t h e st a t e vect or , a n d y is t h e ou t pu t .
Analog Domain
B (s ) b (1 )s n + b (2 )s n – 1 + L+ b (n + 1 )
H (s ) = ----------- = ---------------------------------------------------------------------------------
-
A (s ) s n + a (2 )s n – 1 + L+ a (n + 1 )
Cu toff frequ en cy is t h e fr equ en cy a t wh ich t h e m a gn it u de r espon se of t h e filt er
is equ a l t o –Rs dB. F or cheby2, t h e cu t off fr equ en cy Wn m u st be gr ea t er t h a n 0.
If Wn is a t wo-elem en t vect or , Wn = [w1 w2], wit h w1 < w2, t h en
cheby2(n,Rs,Wn,'s') r et u r n s a n or der 2*n ba n dpa ss a n a log filt er wit h
pa ssba n d w1 < ω < w2.
6-71
cheby2
[z,p,k] = cheby2(n,Rs,Wn,'s') or
[A,B,C,D] = cheby2(n,Rs,Wn,'s') or
[A,B,C,D] = cheby2(n,Rs,Wn,'ftype','s') wh er e A, B, C, a n d D a r e
·
x = Ax + Bu
y = Cx + Du
a n d u is t h e in pu t , x is t h e st a t e vect or , a n d y is t h e ou t pu t .
6-72
cheby2
-20
-40
-60
-80
0 50 100 150 200 250 300 350 400 450 500
Frequency (Hertz)
100
0
Phase (degrees)
-100
-200
-300
-400
0 50 100 150 200 250 300 350 400 450 500
Frequency (Hertz)
Design a fift h -or der ba n dpa ss Ch ebysh ev t ype II filt er wit h pa ssba n d fr om 100
t o 200 H z a n d plot t h e im pu lse r espon se of t h e filt er :
n = 5; r = 20;
Wn = [100 200]/500;
[b,a] = cheby2(n,r,Wn);
[y,t] = impz(b,a,101); stem(t,y)
0.15
0.1
0.05
-0.05
-0.1
-0.15
-0.2
0 10 20 30 40 50 60 70 80 90 100
6-73
cheby2
Limitations F or h igh or der filt er s, t h e st a t e-spa ce for m is t h e m ost n u m er ica lly a ccu r a t e,
followed by t h e zer o-pole-ga in for m . Th e t r a n sfer fu n ct ion coefficien t for m is
t h e lea st a ccu r a t e; n u m er ica l pr oblem s ca n a r ise for filt er or der s a s low a s 15.
6-74
chirp
Purpose 6ch ir p
Swept -fr equ en cy cosin e gen er a t or .
Syntax y = chirp(t,f0,t1,f1)
y = chirp(t,f0,t1,f1,'method')
y = chirp(t,f0,t1,f1,'method',phi)
• wh er e
β = (f 1 – f 0 ) ⁄ t 1
• wh er e
β = (f 1 – f 0 ) ⁄ t 1
f i (t ) = f 0 + 10 βt
wh er e
β = [ log 10 (f 1 – f 0 ) ] ⁄ t 1
• F or a log-sweep, f1 m u st be gr ea t er t h a n f0.
6-75
chirp
500
450
400
350
300
Frequency
250
200
150
100
50
0
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6
Time
6-76
chirp
500
450
400
350
300
Frequency
250
200
150
100
50
0
0 0.5 1 1.5 2 2.5 3 3.5
Time
6-77
chirp
6-78
cohere
Purpose 6coh er e
E st im a t e m a gn it u de squ a r ed coh er en ce fu n ct ion bet ween t wo sign a ls.
P x y (f ) 2
C x y (f ) = -------------------------------
P x x (f )P y y (f )
6-79
cohere
• linear, t o r em ove t h e best st r a igh t -lin e fit fr om t h e pr ewin dowed sect ion s of
x and y
• mean, t o r em ove t h e m ea n fr om t h e pr ewin dowed sect ion s of x a n d y
• none, for n o det r en din g (defa u lt )
6-80
cohere
Example Com pu t e a n d plot t h e coh er en ce est im a t e bet ween t wo color ed n oise sequ en ces
x a n d y:
h = fir1(30,0.2,boxcar(31));
h1 = ones(1,10)/sqrt(10);
r = randn(16384,1);
x = filter(h1,1,r);
y = filter(h,1,x);
cohere(x,y,1024,[],[],512)
0.9
0.8
Coherence Function Estimate
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Frequency
Diagnostics An a ppr opr ia t e dia gn ost ic m essa ge is displa yed wh en in cor r ect a r gu m en t s a r e
u sed:
Requires window's length to be no greater than the FFT length.
Requires NOVERLAP to be strictly less than the window length.
Requires positive integer values for NFFT and NOVERLAP.
Requires vector (either row or column) input.
Requires inputs X and Y to have the same length.
6-81
cohere
6-82
conv
Purpose 6con v
Con volu t ion a n d polyn om ia l m u lt iplica t ion .
Syntax c = conv(a,b)
N –1
c(n + 1 ) = ∑ a (k + 1 )b (n – k )
k =0
c =
4 13 28 27 18
6-83
conv2
Purpose 6con v2
Two-dim en sion a l con volu t ion .
Syntax C = conv2(A,B)
C = conv2(A,B,'shape')
size(C) = [ma+mb–1,na+nb–1]
6-84
conv2
6-85
convmtx
Purpose 6con vm t x
Con volu t ion m a t r ix.
Syntax A = convmtx(c,n)
A = convmtx(r,n)
Description A con volu tion m atrix is a m a t r ix, for m ed fr om a vect or , wh ose in n er pr odu ct
wit h a n ot h er vect or is t h e con volu t ion of t h e t wo vect or s.
1 2 3 2 1 0 0 0 0 0 0
0 1 2 3 2 1 0 0 0 0 0
0 0 1 2 3 2 1 0 0 0 0
0 0 0 1 2 3 2 1 0 0 0
0 0 0 0 1 2 3 2 1 0 0
0 0 0 0 0 1 2 3 2 1 0
0 0 0 0 0 0 1 2 3 2 1
Algorithm convmtx u ses t h e fu n ct ion toeplitz t o gen er a t e t h e con volu t ion m a t r ix.
6-86
convmtx
6-87
corrcoef
Syntax C = corrcoef(X)
C = corrcoef(X,Y)
C (i , j )
cor r coef(i , j ) = -----------------------------------
C (i , i )C (j , j )
6-88
cov
Purpose 6cov
Cova r ia n ce m a t r ix.
Syntax c = cov(x)
c = cov(x,y)
6-89
cplxpair
Syntax y = cplxpair(x)
y = cplxpair(x,tol)
Example Or der five poles even ly spa ced a r ou n d t h e u n it cir cle in t o com plex pa ir s:
cplxpair(exp(2*pi*sqrt(–1)*(0:4)/5)')
ans =
–0.8090 – 0.5878i
–0.8090 + 0.5878i
0.3090 – 0.9511i
0.3090 + 0.9511i
1.0000
6-90
cremez
Purpose 6cr em ez
Com plex a n d n on lin ea r -ph a se equ ir ipple F IR filt er design .
Syntax b = cremez(n,f,'fresp')
b = cremez(n,f,'fresp',w)
b = cremez(n,f,{'fresp',p1,p2,...},w)
b = cremez(n,f,a,w)
b = cremez(...,'sym')
b = cremez(...,'skip_stage2')
b = cremez(...,'debug')
b = cremez(...,{lgrid})
[b,delta,opt] = cremez(...)
6-91
cremez
6-92
cremez
6-93
cremez
opt.fgrid F r equ en cy gr id vect or u sed for t h e filt er design opt im iza t ion
opt.des Desir ed fr equ en cy r espon se for ea ch poin t in opt.fgrid
opt.wt Weigh t in g for ea ch poin t in opt.fgrid
opt.H Act u a l fr equ en cy r espon se for ea ch poin t in opt.fgrid
opt.error E r r or a t ea ch poin t in opt.fgrid
opt.iextr Vect or of in dices in t o opt.fgrid for ext r em a l fr equ en cies
opt.fextr Vect or of ext r em a l fr equ en cies
Examples Example 1
Design a 31-t a p, lin ea r -ph a se, lowpa ss filt er :
b = cremez(30,[–1 –0.5 –0.4 0.7 0.8 1],'lowpass');
freqz(b,1,512,'whole');
50
Magnitude (dB)
−50
−100
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
Normalized Angular Frequency (×π rads/sample)
0
Phase (degrees)
−1000
−2000
−3000
−4000
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
Normalized Angular Frequency (×π rads/sample)
6-94
cremez
Example 2
Design a n on lin ea r -ph a se a llpa ss F IR filt er .
F ir st select (or cr ea t e) t h e fu n ct ion fresp t h a t r et u r n s t h e desir ed fr equ en cy
r espon se. F or t h is exa m ple, fresp is t h e allpass.m fu n ct ion in t h e
signal/signal/private dir ect or y wh ich r et u r n s t h e fr equ en cy r espon se of a
n on lin ea r -ph a se a llpa ss filt er . Copy allpass.m t o a n ot h er loca t ion on t h e
MATLAB pa t h befor e t r yin g t h e exa m ple.
Befor e u sin g cremez wit h allpass.m t o gen er a t e t h e filt er coefficien t s, ca ll
allpass a lon e t o cr ea t e t h e d esired r espon se.
0.2
Magnitude (dB)
0.1
−0.1
−0.2
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
Normalized Angular Frequency (×π rads/sample)
0
Phase (degrees)
−1000
−2000
−3000
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
Normalized Angular Frequency (×π rads/sample)
6-95
cremez
subplot(2,1,2); hold on
plot(pi*(gf+1),unwrap(angle(fftshift(d)))*180/pi,'r--')
legend('Approximation','Desired')
0.2
Magnitude (dB)
0.1
−0.1
−0.2
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
Normalized Angular Frequency (×π rads/sample)
0
Approximation
Phase (degrees)
Desired
−1000
−2000
−3000
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
Normalized Angular Frequency (×π rads/sample)
[dh,dw] = fresp(n,f,gf,w,p1,p2,...) wh er e
• n is t h e filt er or der .
• f is t h e vect or of fr equ en cy ba n d edges t h a t a ppea r m on ot on ica lly bet ween
-1 a n d 1, wh er e 1 is t h e Nyqu ist fr equ en cy.
• gf is a vect or of gr id poin t s t h a t h a ve been lin ea r ly in t er pola t ed over ea ch
specified fr equ en cy ba n d by cremez. gf det er m in es t h e fr equ en cy gr id a t
wh ich t h e r espon se fu n ct ion m u st be eva lu a t ed. Th is is t h e sa m e da t a
r et u r n ed by cremez in t h e fgrid field of t h e opt st r u ct u r e.
6-96
cremez
6-97
cremez
Diagnostics Th e followin g dia gn ost ic m essa ges a r ise fr om in cor r ect u sa ge of cremez:
Not enough input arguments.
Frequency band edges must be in the range [–1,+1] for designs with
SYM = 'sym'.
Frequency band edges must be in the range [0,+1] for designs with
SYM = 'sym'.
6-98
cremez
See Also fir1 Win dow-ba sed fin it e im pu lse r espon se filt er design –
st a n da r d r espon se.
fir2 Win dow-ba sed fin it e im pu lse r espon se filt er design –
a r bit r a r y r espon se.
firls Lea st squ a r e lin ea r -ph a se F IR filt er design .
remez P a r ks-McClella n opt im a l F IR filt er design .
private/bandpass Ba n dpa ss filt er design fu n ct ion .
private/bandstop Ba n dst op filt er design fu n ct ion .
private/different Differ en t ia t or filt er design fu n ct ion .
iator
private/highpass H igh pa ss filt er design fu n ct ion .
private/hilbfilt H ilber t filt er design fu n ct ion .
private/lowpass Lowpa ss filt er design fu n ct ion .
private/multiband Mu lt iba n d filt er design fu n ct ion .
References [1] Ka r a m , L.J ., a n d J .H . McClella n . “Com plex Ch ebysh ev Appr oxim a t ion for
F IR F ilt er Design .” IE E E T ran s. on Circu its an d S ystem s II. Ma r ch 1995.
P gs. 207-216.
[2] Ka r a m , L.J . Design of Com plex Digital FIR Filters in th e Ch ebysh ev S en se.
P h .D. Th esis, Geor gia In st it u t e of Tech n ology, Ma r ch 1995.
[3] Dem ja n jov, V.F ., a n d V.N. Ma lozem ov. In trod u ction to M in im ax. New Yor k :
J oh n Wiley & Son s, 1974.
6-99
csd
Purpose 6csd
E st im a t e t h e cr oss spect r a l den sit y (CSD) of t wo sign a ls.
Description Pxy = csd(x,y) est im a t es t h e cr oss spect r a l den sit y of t h e len gt h n sequ en ces
x a n d y u sin g t h e Welch m et h od of spect r a l est im a t ion . Pxy = csd(x,y) u ses
t h e followin g defa u lt va lu es:
• nfft = min(256,length(x))
• Fs = 2
• window = hanning(nfft)
• noverlap = 0
6-100
csd
• linear, t o r em ove t h e best st r a igh t -lin e fit fr om t h e pr ewin dowed sect ion s of
x and y
• mean, t o r em ove t h e m ea n fr om t h e pr ewin dowed sect ion s of x a n d y
• none, for n o det r en din g (defa u lt )
6-101
csd
Example Gen er a t e t wo color ed n oise sign a ls a n d plot t h eir CSD wit h a con fiden ce
in t er va l of 95%. Specify a len gt h 1024 F F T, a 500 poin t t r ia n gu la r win dow wit h
n o over la p, a n d a sa m plin g fr equ en cy of 10 H z:
h = fir1(30,0.2,boxcar(31));
h1 = ones(1,10)/sqrt(10);
r = randn(16384,1);
x = filter(h1,1,r);
y = filter(h,1,x);
csd(x,y,1024,10000,triang(500),0,[])
20
10
0
Cross Spectrum Magnitude (dB)
-10
-20
-30
-40
-50
-60
-70
0 1000 2000 3000 4000 5000
Frequency
Algorithm csd im plem en t s t h e Welch m et h od of spect r a l den sit y est im a t ion (see
r efer en ces [1] a n d [2]):
6-102
csd
4 It a ver a ges t h e per iodogr a m s of t h e su ccessive over la ppin g sect ion s t o for m
Pxy, t h e cr oss spect r a l den sit y of x a n d y.
Th e n u m ber of sect ion s t h a t csd a ver a ges is k, wh er e k is
fix((length(x)–noverlap)/(length(window)–noverlap))
Diagnostics An a ppr opr ia t e dia gn ost ic m essa ge is displa yed wh en in cor r ect a r gu m en t s t o
csd a r e u sed:
6-103
csd
[3] Oppen h eim , A.V., a n d R.W. Sch a fer . Discrete-T im e S ign al Processin g.
E n glewood Cliffs, NJ : P r en t ice-H a ll, 1989. P g. 737.
6-104
czt
Purpose 6czt
Ch ir p z-t r a n sfor m .
Syntax y = czt(x,m,w,a)
y = czt(x)
• m = length(x)
• w = exp(j*2*pi/m)
•a = 1
Wit h t h ese defa u lt s, czt r et u r n s t h e z-t r a n sfor m of x a t m equ a lly spa ced poin t s
a r ou n d t h e u n it cir cle. Th is is equ iva len t t o t h e discr et e F ou r ier t r a n sfor m of
x, or fft(x). Th e em pt y m a t r ix [] specifies t h e defa u lt va lu e for a pa r a m et er .
6-105
czt
1 1
0.8 0.8
0.6 0.6
0.4 0.4
0.2 0.2
0 0
100 200 300 400 500 100 110 120 130 140
Algorithm czt u ses t h e n ext power -of-2 len gt h F F T t o per for m a fa st con volu t ion wh en
com pu t in g t h e z-t r a n sfor m on a specified ch ir p con t ou r [1]. czt ca n be
sign ifica n t ly fa st er t h a n fft for la r ge, pr im e-len gt h sequ en ces.
6-106
czt
6-107
dct
Purpose 6dct
Discr et e cosin e t r a n sfor m (DCT).
Syntax y = dct(x)
y = dct(x,n)
N
π(2 n – 1 )(k – 1 )
y (k ) = w (k ) ∑ x (n ) cos -------------------------------------------,
2N
k = 1 , …, N
n =1
wh er e
⎧ 1
⎪ ---------, k =1
⎪ N
w (k ) = ⎨
⎪ 2
⎪ ----N
, 2≤k ≤N
⎩
6-108
dct
i =
3
6-109
decimate
Purpose 6decim a t e
Decr ea se t h e sa m plin g r a t e for a sequ en ce (decim a t ion ).
Syntax y = decimate(x,r)
y = decimate(x,r,n)
y = decimate(x,r,'fir')
y = decimate(x,r,n,'fir')
Description Decim a t ion r edu ces t h e or igin a l sa m plin g r a t e for a sequ en ce t o a lower r a t e.
It is t h e opposit e of in t er pola t ion . Th e decim a t ion pr ocess filt er s t h e in pu t da t a
wit h a lowpa ss filt er a n d t h en r esa m ples t h e r esu lt in g sm oot h ed sign a l a t a
lower r a t e.
6-110
decimate
1 1
0 0
-1 -1
-2 -2
0 50 100 0 10 20 30
6-111
decimate
References [1] IE E E . Program s for Digital S ign al Processin g. IE E E P r ess. New Yor k: J oh n
Wiley & Son s, 1979. Ch a pt er 8.
6-112
deconv
Purpose 6decon v
Decon volu t ion a n d polyn om ia l division .
Description [q,r] = deconv(b,a) decon volves vect or a ou t of vect or b, u sin g lon g division .
Th e r esu lt (qu ot ien t ) is r et u r n ed in vect or q a n d t h e r em a in der in vect or r su ch
t h a t b = conv(q,a) + r.
If a a n d b a r e vect or s of polyn om ia l coefficien t s, con volvin g t h em is equ iva len t
t o polyn om ia l m u lt iplica t ion , a n d decon volu t ion is equ iva len t t o polyn om ia l
division . Th e r esu lt of dividin g b by a is qu ot ien t q a n d r em a in der r.
Th e deconv fu n ct ion is pa r t of t h e st a n da r d MATLAB la n gu a ge.
c =
4 13 28 27 18
q =
4 5 6
r =
0 0 0 0 0
6-113
demod
Purpose 6dem od
Dem odu la t ion for com m u n ica t ion s sim u la t ion .
Syntax x = demod(y,Fc,Fs,'method')
x = demod(y,Fc,Fs,'method',opt)
x = demod(y,Fc,Fs,'pwm','centered')
[x1,x2] = demod(y,Fc,Fs,'qam')
Description demod per for m s dem odu la t ion , t h a t is, it obt a in s t h e or igin a l sign a l fr om a
m odu la t ed ver sion of t h e sign a l. demod u n does t h e oper a t ion per for m ed by
modulate.
x = demod(y,Fc,Fs,'method') a n d
6-114
demod
6-115
demod
See Also modulate Modu la t ion for com m u n ica t ion s sim u la t ion .
vco Volt a ge con t r olled oscilla t or.
6-116
dftmtx
Purpose 6dft m t x
Discr et e F ou r ier t r a n sfor m m a t r ix.
Syntax A = dftmtx(n)
ans =
1.8297e-009
6-117
diric
Purpose 6dir ic
Dir ich let or per iodic sin c fu n ct ion .
Syntax y = diric(x,n)
x
⎧ ------ - (n – 1 )
⎪ – 1 2 π x = 0 , ± 2 π, ± 4 π, …
dir ic(x , n ) = ⎨
⎪ sin ( n x ⁄ 2 ) else
⎩ ---------------------------
n sin ( x ⁄ 2 )
-
for a n y n on zer o in t eger n. Th is fu n ct ion h a s per iod 2π for n odd a n d per iod 4π
for n even . It s pea k va lu e is 1, a n d it s m in im u m va lu e is -1 for n even . Th e
m a gn it u de of t h is fu n ct ion is (1/n) t im es t h e m a gn it u de of t h e discr et e-t im e
F ou r ier t r a n sfor m of t h e n-poin t r ect a n gu la r win dow.
6-118
dpss
Purpose 6dpss
Discr et e pr ola t e sph er oida l sequ en ces (Slepia n sequ en ces).
Description [e,v] = dpss(n,nw) gen er a t es t h e fir st 2*nw d iscrete prolate sph eroid al
sequ en ces (DP SS) of len gt h n in t h e colu m n s of e, a n d t h eir cor r espon din g
con cen t r a t ion s in vect or v. Th ey a r e a lso gen er a t ed in t h e DP SS MAT-file
da t a ba se dpss.mat. nw m u st be less t h a n n/2.
F or a ll of t h e a bove for m s,
6-119
dpss
[e,v] = dpss(n,nw,'linear') a n d
[e,v] = dpss(...,'trace') a n d
See Also dpssclear Rem ove discr et e pr ola t e sph er oida l sequ en ces fr om
da t a ba se.
dpssdir Discr et e pr ola t e sph er oida l sequ en ces da t a ba se
dir ect or y.
dpssload Loa d discr et e pr ola t e sph er oida l sequ en ces fr om
da t a ba se.
dpsssave Save discr et e pr ola t e sph er oida l sequ en ces in
da t a ba se.
pmtm Power spect r u m est im a t e u sin g t h e m u lt it a per
m et h od (MTM).
References [1] P er civa l, D.B., a n d A.T. Wa lden . S pectral A n alysis for Ph ysical
Application s: M u ltitaper an d Con ven tion al Un ivariate T ech n iqu es. Ca m br idge:
Ca m br idge Un iver sit y P r ess, 1993.
6-120
dpssclear
Purpose 6dpssclea r
Rem ove discr et e pr ola t e sph er oida l sequ en ces fr om da t a ba se.
Syntax dpssclear(n,nw)
See Also dpss Discr et e pr ola t e sph er oida l sequ en ces (Slepia n
sequ en ces).
dpssdir Discr et e pr ola t e sph er oida l sequ en ces da t a ba se
dir ect or y.
dpssload Loa d discr et e pr ola t e sph er oida l sequ en ces fr om
da t a ba se.
dpsssave Save discr et e pr ola t e sph er oida l sequ en ces in
da t a ba se.
6-121
dpssdir
Purpose 6dpssdir
Discr et e pr ola t e sph er oida l sequ en ces da t a ba se dir ect or y.
Syntax dpssdir
dpssdir(n)
dpssdir(nw,'nw')
dpssdir(n,nw)
index = dpssdir
dpssdir(nw,'nw') list s t h e sequ en ces sa ved wit h t im e-ba n dwidt h pr odu ct nw.
See Also dpss Discr et e pr ola t e sph er oida l sequ en ces (Slepia n
sequ en ces).
dpssclear Rem ove discr et e pr ola t e sph er oida l sequ en ces fr om
da t a ba se.
dpssload Loa d discr et e pr ola t e sph er oida l sequ en ces fr om
da t a ba se.
dpsssave Save discr et e pr ola t e sph er oida l sequ en ces in
da t a ba se.
6-122
dpssload
Purpose 6dpssloa d
Loa d discr et e pr ola t e sph er oida l sequ en ces fr om da t a ba se.
See Also dpss Discr et e pr ola t e sph er oida l sequ en ces (Slepia n
sequ en ces).
dpssclear Rem ove discr et e pr ola t e sph er oida l sequ en ces fr om
da t a ba se.
dpssdir Discr et e pr ola t e sph er oida l sequ en ces da t a ba se
dir ect or y.
dpsssave Save discr et e pr ola t e sph er oida l sequ en ces in
da t a ba se.
6-123
dpsssave
Purpose 6dpsssa ve
Sa ve discr et e pr ola t e sph er oida l sequ en ces in da t a ba se.
Syntax dpsssave(nw,e,v)
status = dpsssave(nw,e,v)
See Also dpss Discr et e pr ola t e sph er oida l sequ en ces (Slepia n
sequ en ces).
dpssclear Rem ove discr et e pr ola t e sph er oida l sequ en ces fr om
da t a ba se.
dpssdir Discr et e pr ola t e sph er oida l sequ en ces da t a ba se
dir ect or y.
dpssload Loa d discr et e pr ola t e sph er oida l sequ en ces fr om
da t a ba se.
6-124
ellip
Purpose 6ellip
E llipt ic (Ca u er ) filt er design .
Description ellip design s lowpa ss, ba n dpa ss, h igh pa ss, a n d ba n dst op digit a l a n d a n a log
ellipt ic filt er s. E llipt ic filt er s offer st eeper r olloff ch a r a ct er ist ics t h a n
Bu t t er wor t h or Ch ebysh ev filt er s, bu t a r e equ ir ipple in bot h t h e pa ss- a n d
st opba n ds. In gen er a l, ellipt ic filt er s m eet given per for m a n ce specifica t ion s
wit h t h e lowest or der of a n y filt er t ype.
Digital Domain
B (z ) b (1 ) + b (2 )z – 1 + L+ b (n + 1 )z – n
H (z ) = ----------- = ---------------------------------------------------------------------------------
A (z ) 1 + a (2 )z – 1 + L+ a (n + 1 )z – n
Th e cu toff frequ en cy is t h e edge of t h e pa ssba n d, a t wh ich t h e m a gn it u de
r espon se of t h e filt er is –Rp dB. F or ellip, t h e cu t off fr equ en cy Wn is a n u m ber
bet ween 0 a n d 1, wh er e 1 cor r espon ds t o h a lf t h e sa m ple fr equ en cy (Nyqu ist
fr equ en cy). Sm a ller va lu es of pa ssba n d r ipple Rp a n d la r ger va lu es of st opba n d
a t t en u a t ion Rs bot h lea d t o wider t r a n sit ion widt h s (sh a llower r olloff
ch a r a ct er ist ics).
If Wn is a t wo-elem en t vect or , Wn = [w1 w2], ellip r et u r n s a n or der 2*n
ba n dpa ss filt er wit h pa ssba n d w1 < ω < w2.
6-125
ellip
[z,p,k] = ellip(n,Rp,Rs,Wn) or
[A,B,C,D] = ellip(n,Rp,Rs,Wn) or
[A,B,C,D] = ellip(n,Rp,Rs,Wn,'ftype') wh er e A, B, C, a n d D a r e
x [n + 1 ] = A x [n ] + B u [n ]
y [n ] = C x [n ] + D u [n ]
a n d u is t h e in pu t , x is t h e st a t e vect or , a n d y is t h e ou t pu t .
Analog Domain
B (s ) b (1 )s n + b (2 )s n – 1 + L+ b (n + 1 )
H (s ) = ----------- = ---------------------------------------------------------------------------------
-
A (s ) s n + a (2 )s n –1 + L+ a (n + 1 )
Th e cu toff frequ en cy is t h e edge of t h e pa ssba n d, a t wh ich t h e m a gn it u de
r espon se of t h e filt er is –Rp dB. F or ellip, t h e cu t off fr equ en cy Wn m u st be
gr ea t er t h a n 0.
If Wn is a t wo-elem en t vect or wit h w1 < w2, t h en ellip(n,Rp,Rs,Wn,'s')
r et u r n s a n or der 2*n ba n dpa ss a n a log filt er wit h pa ssba n d w1 < ω < w2.
6-126
ellip
[z,p,k] = ellip(n,Rp,Rs,Wn,'s') or
[A,B,C,D] = ellip(n,Rp,Rs,Wn,'s') or
[A,B,C,D] = ellip(n,Rp,Rs,Wn,'ftype','s') wh er e A, B, C, a n d D a r e
·
x = Ax + Bu
y = Cx + Du
a n d u is t h e in pu t , x is t h e st a t e vect or , a n d y is t h e ou t pu t .
Examples F or da t a sa m pled a t 1000 H z, design a sixt h -or der lowpa ss ellipt ic filt er wit h a
cu t off fr equ en cy of 300 H z, 3 dB of r ipple in t h e pa ssba n d, a n d 50 dB of
a t t en u a t ion in t h e st opba n d:
[b,a] = ellip(6,3,50,300/500);
6-127
ellip
-20
-40
-60
-80
-100
0 50 100 150 200 250 300 350 400 450 500
Frequency (Hertz)
200
Phase (degrees)
-200
-400
-600
0 50 100 150 200 250 300 350 400 450 500
Frequency (Hertz)
6-128
ellip
Design a 20t h -or der ba n dpa ss ellipt ic filt er wit h a pa ssba n d fr om 100 t o 200 H z
a n d plot it s im pu lse r espon se:
n = 10; Rp = 0.5; Rs = 20;
Wn = [100 200]/500;
[b,a] = ellip(n,Rp,Rs,Wn);
[y,t] = impz(b,a,101); stem(t,y)
title('Impulse Response of n=10 Elliptic Filter')
0.15
0.1
0.05
-0.05
-0.1
-0.15
-0.2
0 10 20 30 40 50 60 70 80 90 100
Limitations F or h igh or der filt er s, t h e st a t e-spa ce for m is t h e m ost n u m er ica lly a ccu r a t e,
followed by t h e zer o-pole-ga in for m . Th e t r a n sfer fu n ct ion for m is t h e lea st
a ccu r a t e; n u m er ica l pr oblem s ca n a r ise for filt er or der s a s low a s 15.
Algorithm Th e design of ellipt ic filt er s is t h e m ost difficu lt a n d com pu t a t ion a lly in t en sive
of t h e Bu t t er wor t h , Ch ebysh ev t ype I a n d II, a n d ellipt ic design s. ellip u ses a
five-st ep a lgor it h m :
6-129
ellip
4 F or digit a l filt er design , ellip u ses bilinear t o con ver t t h e a n a log filt er
in t o a digit a l filt er t h r ou gh a bilin ea r t r a n sfor m a t ion wit h fr equ en cy
pr ewa r pin g. Ca r efu l fr equ en cy a dju st m en t gu a r a n t ees t h a t t h e a n a log
filt er s a n d t h e digit a l filt er s will h a ve t h e sa m e fr equ en cy r espon se
m a gn it u de a t Wn or w1 a n d w2.
5 It con ver t s t h e st a t e-spa ce filt er ba ck t o t r a n sfer fu n ct ion or zer o-pole-ga in
for m , a s r equ ir ed.
6-130
ellipap
Purpose 6ellipa p
E llipt ic a n a log lowpa ss filt er pr ot ot ype.
z (s ) ( s – z (1 ) ) ( s – z (2 ) )Ls ( – z (n ) )
H (s ) = ---------- = k -----------------------------------------------------------------------------
p (s ) ( s – p (1 ) ) ( s – p (2 ) )Ls ( – p (n ) )
E llipt ic filt er s a r e equ ir ipple in bot h t h e pa ssba n d a n d st opba n d. Th ey offer
st eeper r olloff ch a r a ct er ist ics t h a n Bu t t er wor t h a n d Ch ebysh ev filt er s, bu t
t h ey a r e equ ir ipple in bot h t h e pa ssba n d a n d t h e st opba n d. Of t h e fou r cla ssica l
filt er t ypes, ellipt ic filt er s u su a lly m eet a given set of filt er per for m a n ce
specifica t ion s wit h t h e lowest filt er or der .
ellip set s t h e cu t off fr equ en cy ω 0 of t h e ellipt ic filt er t o 1 for a n or m a lized
r esu lt . Th e cu toff frequ en cy is t h e fr equ en cy a t wh ich t h e pa ssba n d en ds a n d
t h e filt er h a s a m a gn it u de r espon se of 10 -Rp/20 .
References [1] P a r ks, T.W., a n d C.S. Bu r r u s. Digital Filter Design . New Yor k: J oh n Wiley
& Son s, 1987. Ch a pt er 7.
6-131
ellipord
Purpose 6ellipord
E llipt ic filt er or der select ion .
Digital Domain
Use ellipord for lowpa ss, h igh pa ss, ba n dpa ss, a n d ba n dst op filt er s. F or
h igh pa ss filt er s, Wp is gr ea t er t h a n Ws. F or ba n dpa ss a n d ba n dst op filt er s, Wp
a n d Ws a r e t wo-elem en t vect or s t h a t specify t h e cor n er fr equ en cies a t bot h
edges of t h e filt er , lower fr equ en cy edge fir st . F or t h e ba n d filt er s, ellipord
r et u r n s Wn a s a t wo-elem en t r ow vect or for in pu t t o ellip.
If filt er specifica t ion s ca ll for a ba n dpa ss or ba n dst op filt er wit h u n equ a l r ipple
in ea ch of t h e pa ssba n ds or st opba n ds, design t h e filt er a s sepa r a t e lowpa ss a n d
h igh pa ss sect ion s a n d ca sca de t h e t wo filt er s t oget h er .
6-132
ellipord
Analog Domain
6-133
ellipord
n =
2
Wn =
0.2000
[b,a] = ellip(n,Rp,Rs,Wn);
freqz(b,a,512,1000);
title('n=2 Elliptic Lowpass Filter')
n = 2 Elliptic Lowpass Filter
0
Magnitude Response (dB)
-20
-40
-60
-80
0 50 100 150 200 250 300 350 400 450 500
Frequency (Hertz)
50
0
Phase (degrees)
-50
-100
-150
-200
0 50 100 150 200 250 300 350 400 450 500
Frequency (Hertz)
6-134
ellipord
n =
3
Wn =
0.1800 0.4000
[b,a] = ellip(n,Rp,Rs,Wn);
freqz(b,a,512,1000);
title('n=3 Elliptic Bandpass Filter')
-100
-200
-300
0 50 100 150 200 250 300 350 400 450 500
Frequency (Hertz)
400
Phase (degrees)
200
-200
-400
0 50 100 150 200 250 300 350 400 450 500
Frequency (Hertz)
Algorithm ellipord u ses t h e ellipt ic lowpa ss filt er or der pr edict ion for m u la descr ibed in
[1]. Th e fu n ct ion per for m s it s ca lcu la t ion s in t h e a n a log dom a in for bot h t h e
a n a log a n d digit a l ca ses. F or t h e digit a l ca se, it con ver t s t h e fr equ en cy
6-135
ellipord
6-136
fft
Purpose 6fft
On e-dim en sion a l fa st F ou r ier t r a n sfor m .
Syntax y = fft(x)
y = fft(x,n)
X (k + 1 ) = ∑ x (n + 1 )W nk n
n =0
6-137
fft
-1
-2
-3
-4
-5
-6
0 5 10 15 20 25 30 35 40 45 50
6-138
fft
70
60
50
40
30
20
10
0
0 100 200 300 400 500
See t h e pwelch fu n ct ion for det a ils on ca lcu la t in g spect r a l den sit y.
Som et im es it is u sefu l t o n or m a lize t h e ou t pu t of fft so t h a t a u n it sin u soid in
t h e t im e dom a in cor r espon ds t o u n it a m plit u de in t h e fr equ en cy dom a in . To
pr odu ce a n or m a lized discr et e-t im e F ou r ier t r a n sfor m in t h is m a n n er , u se
Pn = abs(fft(x))*2/length(x)
6-139
fft
f = (k – 1 ) ∗ f s N
6-140
fft2
Purpose 6fft 2
Two-dim en sion a l fa st F ou r ier t r a n sfor m .
Syntax Y = fft2(X)
Y = fft2(X,m,n)
fft(fft(x).').'
6-141
fftfilt
Syntax y = fftfilt(b,x)
y = fftfilt(b,x,n)
y (n ) = b (1 )x (n ) + b (2 )x (n – 1 ) + L+ b (n b + 1 )x (n – n b )
An equ iva len t r epr esen t at ion is t h e z-t r an sfor m or frequ en cy d om ain descr ipt ion
Y (z ) = ( b (1 ) + b (2 )z – 1 + L+ b (n b + 1 )z – n b )X (z )
By defa u lt , fftfilt ch ooses a n F F T len gt h a n d da t a block len gt h t h a t
gu a r a n t ee efficien t execu t ion t im e.
ans =
9.5914e–15
Algorithm fftfilt u ses fft t o im plem en t t h e overlap-ad d m eth od [1], a t ech n iqu e t h a t
com bin es su ccessive fr equ en cy dom a in filt er ed blocks of a n in pu t sequ en ce.
fftfilt br ea k s a n in pu t sequ en ce x in t o len gt h L da t a blocks:
x . . .
L 2L 3L ceil(nx/L)*L
6-142
fftfilt
L nb–1
2L nb–1
3L nb–1
. . .
2^nextpow2(length(b) + length(x) – 1)
References [1] Oppen h eim , A.V., a n d R.W. Sch a fer . Discrete-T im e S ign al Processin g.
E n glewood Cliffs, NJ : P r en t ice H a ll, 1989.
6-143
fftshift
Syntax y = fftshift(x)
Example F or a n y a r r a y X,
Y = fft2(x)
6-144
filter
Purpose 6filt er
F ilt er da t a wit h a r ecu r sive (IIR) or n on r ecu r sive (F IR) filt er .
Syntax y = filter(b,a,x)
[y,zf] = filter(b,a,x)
[...] = filter(b,a,x,zi)
[...] = filter(b,a,x,zi,dim)
Description filter filt er s r ea l or com plex da t a u sin g a digit a l filt er . Th e filt er r ea liza t ion
is t h e tran sposed d irect form II st r u ct u r e [1], wh ich ca n h a n dle bot h F IR a n d
IIR filt er s.
If a(1) ≠ 1, filter n or m a lizes t h e filt er coefficien t s by a(1). If a(1) = 0, t h e in pu t
is in er r or .
6-145
filter
0.4
0.3
0.2
0.1
-0.1
-0.2
0 20 40 60 80 100 120
x(m) ...
b(n) b( 3 ) b( 2 ) b(1)
Σ z -1 ... Σ z -1 Σ z -1 Σ y(m)
z n -1 (m) z 2 (m) z 1 (m)
– a(n) – a( 3 ) – a( 2 )
...
wh er e n -1 is t h e filt er or der .
6-146
filter
y (m ) = b (1 )x (m ) + z 1 (m – 1 ) – a (1 )y (m )
z 1 (m ) = b (2 )x (m ) + z 2 (m – 1 ) – a (2 )y (m )
M = M
zn – 2 (m ) = b (n – 1 )x (m ) + z n – 1 (m – 1 ) – a (n – 1 )y (m )
zn – 1 (m ) = b (n )x (m ) – a (n )y (m )
b (1 ) + b (2 )z –1 + L+ b (n b + 1 )z – n b
Y (z ) = ----------------------------------------------------------------------------------------
- X (z )
a (1 ) + a (2 )z – 1 + L+ a (n a + 1 )z – n a
References [1] Oppen h eim , A.V., a n d R.W. Sch a fer . Discrete-T im e S ign al Processin g.
E n glewood Cliffs, NJ : P r en t ice H a ll, 1989. P gs. 311-312.
6-147
filter2
Purpose 6filt er 2
Two-dim en sion a l digit a l filt er in g.
Syntax Y = filter2(B,X)
Y = filter2(B,X,'shape')
6-148
filtfilt
Syntax y = filtfilt(b,a,x)
References [1] Oppen h eim , A.V., a n d R.W. Sch a fer . Discrete-T im e S ign al Processin g.
E n glewood Cliffs, NJ : P r en t ice H a ll, 1989. P gs. 311-312.
6-149
filtic
Purpose 6filt ic
F in d in it ia l con dit ion s for a t r a n sposed dir ect for m II filt er im plem en t a t ion .
Syntax z = filtic(b,a,y,x)
z = filtic(b,a,y)
x = { x (– 1 ), x (– 2 ), x (– 3 ), …, x (– n b ), … }
y = { y (– 1 ), y (– 2 ), y (– 3 ), …, y (– n a ), … }
wh er e nb is length(b)–1 (t h e n u m er a t or or der ) a n d na is length(a)–1 (t h e
den om in a t or or der ). If length(x) is less t h a n nb, filtic pa ds it wit h zer os t o
len gt h nb; if length(y) is less t h a n na, filtic pa ds it wit h zer os t o len gt h na.
E lem en t s of x beyon d x(nb–1) a n d elem en t s of y beyon d y(na–1) a r e
u n n ecessa r y so filtic ign or es t h em .
Ou t pu t z is a colu m n vect or of len gt h equ a l t o t h e la r ger of n b a n d n a.
z descr ibes t h e st a t e of t h e dela ys given pa st in pu t s x a n d pa st ou t pu t s y.
z = filtic(b,a,y) a ssu m es t h a t t h e in pu t x is 0 in t h e pa st .
b(n) b( 3 ) b( 2 ) b(1)
Σ z -1 ... Σ z -1 Σ z -1 Σ y(m)
z n -1 (m) z 2 (m) z 1 (m)
– a(n) – a( 3 ) – a( 2 )
...
wh er e n -1 is t h e filt er or der .
filtic wor k s for bot h r ea l a n d com plex in pu t s.
6-150
filtic
Algorithm filtic per for m s a r ever se differ en ce equ a t ion t o obt a in t h e dela y st a t es z.
See Also filter F ilt er da t a wit h a r ecu r sive (IIR) or n on r ecu r sive
(F IR) filt er.
filtfilt Zer o-ph a se digit a l filt er in g.
References [1] Oppen h eim , A.V., a n d R.W. Sch a fer . Discrete-T im e S ign al Processin g.
E n glewood Cliffs, NJ : P r en t ice H a ll, 1989. P gs. 296, 301-302.
6-151
fir1
Purpose 6fir 1
Win dow-ba sed fin it e im pu lse r espon se filt er design – st a n da r d r espon se.
Syntax b = fir1(n,Wn)
b = fir1(n,Wn,'ftype')
b = fir1(n,Wn,window)
b = fir1(n,Wn,'ftype',window)
b = fir1(...,'noscale')
Description fir1 im plem en t s t h e cla ssica l m et h od of win dowed lin ea r -ph a se F IR digit a l
filt er design [1]. It design s filt er s in st a n da r d lowpa ss, ba n dpa ss, h igh pa ss, a n d
ba n dpa ss con figu r a t ion s. (F or win dowed filt er s wit h a r bit r a r y fr equ en cy
r espon se, u se fir2.)
B (z ) = b (1 ) + b (2 )z –1 + L+ b (n + 1 )z –n
Wn, t h e cu t off fr equ en cy, is a n u m ber bet ween 0 a n d 1, wh er e 1 cor r espon ds t o
h a lf t h e sa m plin g fr equ en cy (t h e Nyqu ist fr equ en cy).
If Wn is a t wo-elem en t vect or , Wn = [w1 w2], fir1 r et u r n s a ba n dpa ss filt er wit h
pa ssba n d w1 < ω < w2.
If Wn is a m u lt i-elem en t vect or , Wn = [w1 w2 w3 w4 w5 ... wn], fir1 r et u r n s
a n or der n m u lt iba n d filt er wit h ba n ds 0 < ω < w1, w1 < ω < w2, ..., wn < ω < 1.
By defa u lt , t h e filt er is sca led so t h a t t h e cen t er of t h e fir st pa ssba n d h a s
m a gn it u de exa ct ly 1 a ft er win dowin g.
6-152
fir1
Algorithm fir1 u ses t h e win dow m et h od of F IR filt er design [1]. If w (n ) den ot es a win dow,
wh er e 1 ≤ n ≤ N , a n d t h e im pu lse r espon se of t h e idea l filt er is h (n ), wh er e
h (n ) is t h e in ver se F ou r ier t r a n sfor m of t h e idea l fr equ en cy r espon se, t h en t h e
win dowed digit a l filt er coefficien t s a r e given by
b (n ) = w (n )h (n ), 1≤n ≤N
6-153
fir1
Examples Example 1
Design a 48t h -or der F IR ba n dpa ss filt er wit h pa ssba n d 0.35 ≤ w ≤ 0.65:
b = fir1(48,[0.35 0.65]);
freqz(b,1,512)
50
Magnitude (dB)
−50
−100
0 0.2 0.4 0.6 0.8 1
Normalized Angular Frequency (×π rads/sample)
0
Phase (degrees)
−500
−1000
−1500
−2000
−2500
0 0.2 0.4 0.6 0.8 1
Normalized Angular Frequency (×π rads/sample)
Example 2
Th e chirp.mat file con t a in s a sign a l, y, t h a t h a s m ost of it s power a bove Fs/4,
or h a lf t h e Nyqu ist fr equ en cy. Design a 34t h -or der F IR h igh pa ss filt er t o
a t t en u a t e t h e com pon en t s of t h e sign a l below Fs/4. Use a cu t off fr equ en cy of
0.48 a n d a Ch ebysh ev win dow wit h 30 dB of r ipple:
load chirp % loads y and Fs
b = fir1(34,0.48,'high',chebwin(35,30));
yfilt = filter(b,1,y);
6-154
fir1
−40
Chirp
−50 Filtered Chirp
−60
−70
Magnitude (dB)
−80
−90
−100
−110
−120
−130
−140
0 500 1000 1500 2000 2500 3000 3500 4000 4500
Frequency (Hz)
6-155
fir1
See Also filter F ilt er da t a wit h a r ecu r sive (IIR) or n on r ecu r sive
(F IR) filt er.
fir2 Win dow-ba sed fin it e im pu lse r espon se filt er
design —a r bit r a r y r espon se.
fircls Con st r a in ed lea st squ a r e F IR filt er design for
m u lt iba n d filt er s.
fircls1 Con st r a in ed lea st squ a r e filt er design for lowpa ss
a n d h igh pa ss lin ea r ph a se F IR filt er s.
firls Lea st squ a r e lin ea r-ph a se F IR filt er design .
freqz F r equ en cy r espon se of digit a l filt er s.
kaiserord E st im a t e pa r a m et er s for fir1 wit h Ka iser win dow.
remez Pa r ks-McClella n opt im a l F IR filt er design .
References [1] IE E E . Program s for Digital S ign al Processin g. IE E E P r ess. New Yor k: J oh n
Wiley & Son s, 1979. Algor it h m 5.2.
6-156
fir2
Purpose 6fir 2
Win dow-ba sed fin it e im pu lse r espon se filt er design – a r bit r a r y r espon se.
Syntax b = fir2(n,f,m)
b = fir2(n,f,m,window)
b = fir2(n,f,m,npt)
b = fir2(n,f,m,npt,window)
b = fir2(n,f,m,npt,lap)
b = fir2(n,f,m,npt,lap,window)
Description fir2 design s win dowed digit a l F IR filt er s wit h a r bit r a r ily sh a ped fr equ en cy
r espon se. (F or st a n da r d lowpa ss, ba n dpa ss, h igh pa ss, a n d ba n dst op
con figu r a t ion s, u se fir1.)
b (z ) = b (1 ) + b (2 )z –1 + L+ b (n + 1 )z –n
6-157
fir2
b = fir2(n,f,m,npt) a n d
b = fir2(n,f,m,npt,lap) a n d
Algorithm Th e desir ed fr equ en cy r espon se is in t er pola t ed on t o a den se, even ly spa ced gr id
of len gt h npt. npt is 512 by defa u lt . If t wo su ccessive va lu es of f a r e t h e sa m e,
a r egion of lap poin t s is set u p a r ou n d t h is fr equ en cy t o pr ovide a sm oot h bu t
st eep t r a n sit ion in t h e r equ est ed fr equ en cy r espon se. By defa u lt , lap is 25. Th e
filt er coefficien t s a r e obt a in ed by a pplyin g a n in ver se fa st F ou r ier t r a n sfor m t o
t h e gr id a n d m u lt iplyin g by a win dow; by defa u lt , t h is is a H a m m in g win dow.
6-158
fir2
Example Design a 30t h -or der lowpa ss filt er a n d over plot t h e desir ed fr equ en cy r espon se
wit h t h e a ct u a l fr equ en cy r espon se:
f = [0 0.6 0.6 1]; m = [1 1 0 0];
b = fir2(30,f,m);
[h,w] = freqz(b,1,128);
plot(f,m,w/pi,abs(h))
1.2
0.8
0.6
0.4
0.2
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
6-159
fircls
Syntax b = fircls(n,f,amp,up,lo)
fircls(n,f,amp,up,lo,'design_flag')
6-160
fircls
-2
0 0.2 0.4 0.6 0.8 1 1.2 1.4
0.02
Band #1
0
-0.02
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4
1.02
Band #2
1
0.98
0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8
0.01
Band #3
0
-0.01
0.8 0.85 0.9 0.95 1
Frequency
6-161
fircls
See Also fircls1 Con st r a in ed lea st squ a r e filt er design for lowpa ss
a n d h igh pa ss lin ea r ph a se F IR filt er s.
firls Lea st squ a r e lin ea r-ph a se F IR filt er design .
remez Pa r ks-McClella n opt im a l F IR filt er design .
6-162
fircls1
Syntax b = fircls1(n,wo,dp,ds)
b = fircls1(n,wo,dp,ds,'high')
b = fircls1(n,wo,dp,ds,wt)
b = fircls1(n,wo,dp,ds,wt,'high')
b = fircls1(n,wo,dp,ds,wp,ws,k)
b = fircls1(n,wo,dp,ds,wp,ws,k,'high')
b = fircls1(n,wo,dp,ds,…,'design_flag')
b = fircls1(n,wo,dp,ds,wt) a n d
• Lowpa ss:
- 0<wt<wo<1: t h e a m plit u de of t h e filt er is wit h in dp of 1 over t h e fr equ en cy
r a n ge 0 < ω < wt.
- 0<wo<wt<1: t h e a m plit u de of t h e filt er is wit h in ds of 0 over t h e fr equ en cy
r a n ge wt < ω < 1.
• H igh pa ss:
- 0<wt<wo<1: t h e a m plit u de of t h e filt er is wit h in ds of 0 over t h e fr equ en cy
r a n ge 0 < ω < wt.
- 0<wo<wt<1: t h e a m plit u de of t h e filt er is wit h in dp of 1 over t h e fr equ en cy
r a n ge wt < ω < 1.
6-163
fircls1
6-164
fircls1
0.5
0
0 0.2 0.4 0.6 0.8 1
0.04
0.02
0
-0.02
-0.04
0 0.05 0.1 0.15 0.2 0.25
0.01
-0.01
6-165
firls
Purpose 6fir ls
Lea st squ a r e lin ea r -ph a se F IR filt er design .
Syntax b = firls(n,f,a)
b = firls(n,f,a,w)
b = firls(n,f,a,'ftype')
b = firls(n,f,a,w,'ftype')
b (k ) = b (n + 2 – k ), k = 1 , …, n + 1
Th ese a r e t ype I (n odd) a n d t ype II (n even ) lin ea r -ph a se filt er s. Vect or s f a n d
a specify t h e fr equ en cy-a m plit u de ch a r a ct er ist ics of t h e filt er :
6-166
firls
f = [0 .3 .4 .6 .7 .9]
a = [0 1 0 0 .5 .5]
Desired amplitude
response (a) 1.0
0.5
Normalized
0.0 frequency (f)
0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 (Nyquist)
b = firls(n,f,a,'ftype') a n d
• hilbert for lin ea r -ph a se filt er s wit h odd sym m et r y (t ype III a n d t ype IV)
Th e ou t pu t coefficien t s in b obey t h e r ela t ion b(k ) = -b(n + 2 - k ),
k = 1, ..., n + 1. Th is cla ss of filt er s in clu des t h e H ilber t t r a n sfor m er , wh ich
h a s a desir ed a m plit u de of 1 a cr oss t h e en t ir e ba n d.
• differentiator for t ype III a n d t ype IV filt er s, u sin g a specia l weigh t in g
t ech n iqu e
F or n on zer o a m plit u de ba n ds, t h e in t egr a t ed squ a r ed er r or h a s a weigh t of
(1/f)2 so t h a t t h e er r or a t low fr equ en cies is m u ch sm a ller t h a n a t h igh
fr equ en cies. F or F IR differ en t ia t or s, wh ich h a ve a n a m plit u de ch a r a ct er ist ic
pr opor t ion a l t o fr equ en cy, t h e filt er s m in im ize t h e r ela t ive in t egr a t ed
squ a r ed er r or (t h e in t egr a l of t h e squ a r e of t h e r a t io of t h e er r or t o t h e
desir ed a m plit u de).
6-167
firls
Design a 24t h -or der a n t i-sym m et r ic filt er wit h piecewise lin ea r pa ssba n ds a n d
plot t h e desir ed a n d a ct u a l fr equ en cy r espon se:
F = [0 0.3 0.4 0.6 0.7 0.9];
A = [0 1 0 0 0.5 0.5];
b = firls(24,F,A,'hilbert');
for i=1:2:6,
plot([F(i) F(i+1)],[A(i) A(i+1)],'– –'), hold on
end
[H,f] = freqz(b,1,512,2);
plot(f,abs(H)), grid on, hold off
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Algorithm Refer en ce [1] descr ibes t h e t h eor et ica l a ppr oa ch t h a t firls t a kes. Th e fu n ct ion
solves a syst em of lin ea r equ a t ion s in volvin g a n in n er pr odu ct m a t r ix of size
r ou gh ly n/2 u sin g MATLAB’s \ oper a t or .
6-168
firls
Linear
Phase Filter Response H(f), Response H(f),
Filter Type Order n Symmetry of Coefficients f=0 f = 1 (Nyquist)
Diagnostics An a ppr opr ia t e dia gn ost ic m essa ge is displa yed wh en in cor r ect a r gu m en t s a r e
u sed:
F must be even length.
F and A must be equal lengths.
Requires symmetry to be 'hilbert' or 'differentiator'.
Requires one weight per band.
Frequencies in F must be nondecreasing.
Frequencies in F must be in range [0,1].
6-169
firls
See Also fir1 Win dow-ba sed fin it e im pu lse r espon se filt er design –
st a n da r d r espon se.
fir2 Win dow-ba sed fin it e im pu lse r espon se filt er design –
a r bit r a r y r espon se.
firrcos Ra ised cosin e F IR filt er design .
remez Pa r ks-McClella n opt im a l F IR filt er design .
References [1] P a r ks, T.W., a n d C.S. Bu r r u s. Digital Filter Design . New Yor k: J oh n Wiley
& Son s, 1987. P gs. 54-83.
[2] Oppen h eim , A.V., a n d R.W. Sch a fer . Discrete-T im e S ign al Processin g.
E n glewood Cliffs, NJ : P r en t ice H a ll, 1989. P gs. 256-266.
6-170
firrcos
b = firrcos(n,F0,r,Fs,'rolloff') in t er pr et s t h e t h ir d a r gu m en t , r, a s t h e
r olloff fa ct or in st ea d of t h e t r a n sit ion ba n dwidt h , df. r m u st be in t h e r a n ge
[0,1].
6-171
firrcos
Example Design a n or der 20 r a ised cosin e F IR filt er wit h cu t off fr equ en cy 0.25 of t h e
Nyqu ist fr equ en cy a n d a t r a n sit ion ba n dwidt h of 0.25:
h = firrcos(20,0.25,0.25);
freqz(h,1,'Fs',2,'phase','no')
20
−20
Magnitude (dB)
−40
−60
−80
−100
−120
0 0.2 0.4 0.6 0.8 1
Frequency (Hz)
See Also fir1 Win dow-ba sed fin it e im pu lse r espon se filt er design –
st a n da r d r espon se.
fir2 Win dow-ba sed fin it e im pu lse r espon se filt er design –
a r bit r a r y r espon se.
firls Lea st squ a r e lin ea r-ph a se F IR filt er design .
remez Pa r ks-McClella n opt im a l F IR filt er design .
6-172
freqs
Purpose 6freqs
F r equ en cy r espon se of a n a log filt er s.
Syntax h = freqs(b,a,w)
[h,w] = freqs(b,a)
[h,w] = freqs(b,a,n)
freqs(b,a)
Description freqs r et u r n s t h e com plex fr equ en cy r espon se H (jw ) (La pla ce t r a n sfor m ) of a n
a n a log filt er :
B (s ) b (1 )s n b + b (2 )s n b – 1 + L+ b (n b + 1 )
H (s ) = ----------- = ---------------------------------------------------------------------------------------------
-
A (s ) a (1 )s n a + a (2 )s n a – 1 + L+ a (n a + 1 )
given t h e n u m er a t or a n d den om in a t or coefficien t s in vect or s b a n d a.
6-173
freqs
0.2 s 2 + 0.3 s + 1
H (s ) = -----------------------------------------
s 2 + 0.4 s + 1
a = [1 0.4 1];
b = [0.2 0.3 1];
w = logspace(–1,1);
freqs(b,a,w)
1
10
Magnitude
0
10
-1
10 -1 0 1
10 10 10
Frequency
0
Phase (degrees)
-50
-100
-150 -1 0 1
10 10 10
Frequency
6-174
freqs
6-175
freqspace
Syntax f = freqspace(n)
f = freqspace(n,'whole')
[f1,f2] = freqspace(n)
[f1,f2] = freqspace([m n])
[x1,y1] = freqspace(n,'meshgrid')
[x1,y1] = freqspace([m n],'meshgrid')
Description freqspace r et u r n s t h e im plied fr equ en cy r a n ge for equ a lly spa ced fr equ en cy
r espon ses. Th is is u sefu l wh en cr ea t in g fr equ en cy vect or s for u se wit h freqz.
[x1,y1] = freqspace(n,'meshgrid') a n d
[f1,f2] = freqspace(...);
[x1,y1] = meshgrid(f1,f2);
6-176
freqz
Purpose 6freqz
F r equ en cy r espon se of digit a l filt er s.
Description freqz r et u r n s t h e com plex fr equ en cy r espon se H (ejω) of a digit a l filt er , given
t h e (r ea l or com plex) n u m er a t or a n d den om in a t or coefficien t s in vect or s b
a n d a.
[h,w] = freqz(b,a,n) r et u r n s t h e n-poin t com plex fr equ en cy r espon se of t h e
digit a l filt er
B (z ) b (1 ) + b (2 )z – 1 + L+ b (n b + 1 )z – n b
H (z ) = ----------- = ----------------------------------------------------------------------------------------
-
A (z ) a (1 ) + a (2 )z – 1 + L+ a (n a + 1 )z – n a
eva lu a t ed a t z=ejω given t h e coefficien t vect or s b a n d a. freqz r et u r n s bot h h,
t h e com plex fr equ en cy r espon se, a n d w, a vect or con t a in in g t h e n fr equ en cy
poin t s in u n it s of r a ds/sa m ple. freqz eva lu a t es t h e fr equ en cy r espon se a t n
poin t s equ a lly spa ced a r ou n d t h e u pper h a lf of t h e u n it cir cle, so w con t a in s n
poin t s bet ween 0 a n d π.
It is best , a lt h ou gh n ot n ecessa r y, t o ch oose a va lu e for n t h a t is a n exa ct power
of t wo, beca u se t h is a llows fa st com pu t a t ion u sin g a n F F T a lgor it h m . If you do
n ot specify a va lu e for n, it defa u lt s t o 512.
6-177
freqz
50
Magnitude (dB)
−50
−100
−150
0 0.2 0.4 0.6 0.8 1
Normalized Angular Frequency (×π rads/sample)
0
Phase (degrees)
−1000
−2000
−3000
−4000
−5000
0 0.2 0.4 0.6 0.8 1
Normalized Angular Frequency (×π rads/sample)
6-178
freqz
6-179
gauspuls
Syntax yi = gauspuls(t,fc,bw)
yi = gauspuls(t,fc,bw,bwr)
[yi,yq] = gauspuls(…)
[yi,yq,ye] = gauspuls(…)
tc = gauspuls('cutoff',fc,bw,bwr,tpe)
6-180
gauspuls
0.8
0.6
0.4
0.2
-0.2
-0.4
-0.6
-0.8
-4 -2 0 2 4
-5
x 10
6-181
grpdelay
d θ(ω)
τ g (ω) = – ---------------
dω
wh er e ω is fr equ en cy a n d θ is t h e ph a se a n gle of H (ejω).
B (z ) b (1 ) + b (2 )z – 1 + L+ b (n b + 1 )z – n b
H (z ) = ----------- = ----------------------------------------------------------------------------------------
-
A (z ) a (1 ) + a (2 )z – 1 + L+ a (n a + 1 )z –n a
given t h e n u m er a t or a n d den om in a t or coefficien t s in vect or s b a n d a. grpdelay
r et u r n s bot h gd, t h e gr ou p dela y, a n d w, a vect or con t a in in g t h e n fr equ en cy
poin t s in r a dia n s. grpdelay eva lu a t es t h e gr ou p dela y a t n poin t s equ a lly
spa ced a r ou n d t h e u pper h a lf of t h e u n it cir cle, so w con t a in s n poin t s bet ween
0 a n d π. A va lu e for n t h a t is a n exa ct power of t wo a llows fa st com pu t a t ion
u sin g a n F F T a lgor it h m .
6-182
grpdelay
[gd,w] = grpdelay(b,a,n,'whole') a n d
gd = grpdelay(b,a,w) a n d
12
10
Group delay (in samples)
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized frequency (Nyquist == 1)
6-183
grpdelay
12
Group Delay
10 Phase Delay
−2
−4
−6
−8
0 0.5 1 1.5 2 2.5 3 3.5
Frequency (rads/sec)
6-184
hamming
Purpose 6h a m m in g
H a m m in g win dow.
Syntax w = hamming(n)
w = hamming(n,sflag)
k
w [ k + 1 ] = 0.54 – 0.46 cos ⎛ 2 π -------------⎞ , k = 0 , …, n – 1
⎝ n – 1 ⎠
References [1] Oppen h eim , A.V., a n d R.W. Sch a fer , Discrete-T im e S ign al Processin g.
E n glewood Cliffs, NJ : P r en t ice-H a ll, 1989.
6-185
hanning
Purpose 6h a n n in g
H a n n in g win dow.
Syntax w = hanning(n)
w = hanning(n,sflag)
k
w [ k ] = 0.5 ⎛ 1 – cos ⎛ 2 π -------------⎞ ⎞ , k = 1 , …, n
⎝ ⎝ n + 1 ⎠ ⎠
References [1] Oppen h eim , A.V., a n d R.W. Sch a fer , Discrete-T im e S ign al Processin g.
E n glewood Cliffs, NJ : P r en t ice-H a ll, 1989.
6-186
hilbert
Purpose 6h ilber t
H ilber t t r a n sfor m .
Syntax y = hilbert(x)
Algorithm Th e a n a lyt ic sign a l for a sequ en ce x h a s a on e-sid ed Fou rier tran sform , t h a t is,
n ega t ive fr equ en cies a r e 0. To a ppr oxim a t e t h e a n a lyt ic sign a l, hilbert
ca lcu la t es t h e F F T of t h e in pu t sequ en ce, r epla ces t h ose F F T coefficien t s t h a t
cor r espon d t o n ega t ive fr equ en cies wit h zer os, a n d ca lcu la t es t h e in verse F F T
of t h e r esu lt .
In det a il, hilbert u ses a fou r -st ep a lgor it h m :
6-187
hilbert
References [1] Cla er bou t , J .F . Fu n d am en tals of Geoph ysical Data Processin g. New Yor k :
McGr a w-H ill, 1976. P gs. 59-62.
6-188
icceps
Purpose 6icceps
In ver se com plex cepst r u m .
Syntax x = icceps(xhat,nd)
References [1] Oppen h eim , A.V., a n d R.W. Sch a fer . Digital S ign al Processin g. E n glewood
Cliffs, NJ : P r en t ice H a ll, 1975.
6-189
idct
Purpose 6idct
In ver se discr et e cosin e t r a n sfor m .
Syntax x = idct(y)
x = idct(y,n)
N
π(2 n – 1 )(k – 1 )
x (n ) = ∑ w (k )y (k ) cos ------------------------------------------
2N
-, n = 1 , …, N
k =1
wh er e
⎧ 1
⎪ ---------, k =1
⎪ N
w (k ) = ⎨
⎪ 2
⎪ ----N
, 2≤k ≤N
⎩
6-190
idct
6-191
ifft
Purpose 6ifft
On e-dim en sion a l in ver se fa st F ou r ier t r a n sfor m .
Syntax y = ifft(x)
y = ifft(x,n)
6-192
ifft2
Purpose 6ifft 2
Two-dim en sion a l in ver se fa st F ou r ier t r a n sfor m .
Syntax Y = ifft2(X)
Y = ifft2(X,m,n)
6-193
impinvar
Example Con ver t a n a n a log lowpa ss filt er t o a digit a l filt er u sin g impinvar wit h a
sa m plin g fr equ en cy of 10 H z:
[b,a] = butter(4,0.3,'s');
[bz,az] = impinvar(b,a,10)
bz =
1.0e-006 *
az =
6-194
impinvar
References [1] P a r ks, T.W., a n d C.S. Bu r r u s. Digital Filter Design . New Yor k: J oh n Wiley
& Son s, 1987. P gs. 206-209.
6-195
impz
Purpose 6im pz
Im pu lse r espon se of digit a l filt er s.
6-196
impz
Example P lot t h e fir st 50 sa m ples of t h e im pu lse r espon se of a fou r t h -or der lowpa ss
ellipt ic filt er wit h cu t off fr equ en cy of 0.4 t im es t h e Nyqu ist fr equ en cy:
[b,a] = ellip(4,0.5,20,0.4);
impz(b,a,50)
0.5
0.4
0.3
0.2
0.1
-0.1
-0.2
0 5 10 15 20 25 30 35 40 45
filter(b,a,[1 zeros(1,n–1)])
6-197
impz
See Also impulse Un it im pu lse r espon se (see Con trol S ystem T oolbox
User’s Gu id e).
stem P lot discr et e sequ en ce da t a (see t h e on lin e M AT L A B
Fu n ction R eferen ce).
6-198
interp
Purpose 6in t er p
In cr ea se sa m plin g r a t e by a n in t eger fa ct or (in t er pola t ion ).
Syntax y = interp(x,r)
y = interp(x,r,l,alpha)
[y,b] = interp(x,r,l,alpha)
1.5 1.5
1 1
0.5 0.5
0 0
-0.5 -0.5
-1 -1
-1.5 -1.5
-2 -2
0 5 10 15 20 25 30 0 20 40 60 80 100 120
6-199
interp
Algorithm interp u ses t h e lowpa ss in t er pola t ion Algor it h m 8.1 descr ibed in [1]:
References [1] IE E E . Program s for Digital S ign al Processin g. IE E E P r ess. New Yor k: J oh n
Wiley & Son s, 1979. Algor it h m 8.1.
6-200
intfilt
Syntax b = intfilt(r,l,alpha)
b = intfilt(r,n,'Lagrange')
Examples Design a digit a l in t er pola t ion filt er t o u psa m ple a sign a l by fou r , u sin g t h e
ba n dlim it ed m et h od:
alpha = 0.5; % "bandlimitedness" factor
h1 = intfilt(4,2,alpha); % bandlimited interpolation
Now zer o pa d t h e sign a l wit h t h r ee zer os bet ween ever y sa m ple. Th e r esu lt in g
sequ en ce is fou r t im es t h e len gt h of x:
xr = reshape([x zeros(length(x),3)]',4*length(x),1);
6-201
intfilt
0.5
-0.5
-1
-1.5
100 110 120 130 140 150 160 170 180 190 200
Sample Number
h2 =
0.2500 0.5000 0.7500 1.0000 0.7500 0.5000 0.2500
Algorithm Th e ba n dlim it ed m et h od u ses firls t o design a n in t er pola t ion F IR equ iva len t
t o t h a t pr esen t ed in [1]. Th e polyn om ia l m et h od u ses La gr a n ge’s polyn om ia l
in t er pola t ion for m u la on equ a lly spa ced sa m ples t o con st r u ct t h e a ppr opr ia t e
filt er .
References [1] Oet ken , P a r ks, a n d Sch ü ßler . “New Resu lt s in t h e Design of Digit a l
In t er pola t or s.” IE E E T ran s. Acou st., S peech , S ign al Processin g. Vol. ASSP -23
(J u n e 1975). P gs. 301-309.
6-202
invfreqs
Description invfreqs is t h e in ver se oper a t ion of freqs; it fin ds a con t in u ou s-t im e t r a n sfer
fu n ct ion t h a t cor r espon ds t o a given com plex fr equ en cy r espon se. F r om a
la bor a t or y a n a lysis st a n dpoin t , invfreqs is u sefu l in con ver t in g m a gn it u de
a n d ph a se da t a in t o t r a n sfer fu n ct ion s.
B (s ) b (1 )s n b + b (2 )s n b – 1 + L+ b (n b + 1 )
H (s ) = ----------- = ---------------------------------------------------------------------------------------------
-
A (s ) a (1 )s n a + a (2 )s n a – 1 + L+ a (n a + 1 )
wh ose com plex fr equ en cy r espon se is given in vect or h a t t h e fr equ en cy poin t s
specified in vect or w. Sca la r s nb a n d na specify t h e desir ed or der s of t h e
n u m er a t or a n d den om in a t or polyn om ia ls.
F r equ en cy is specified in r a dia n s bet ween 0 a n d π, a n d t h e len gt h of h m u st be
t h e sa m e a s t h e len gt h of w. invfreqs u ses conj(h) a t —w t o en su r e t h e pr oper
fr equ en cy dom a in sym m et r y for a r ea l filt er .
invfreqs(h,w,nb,na,wt,iter) a n d
6-203
invfreqs
Remarks Wh en bu ildin g h igh er or der m odels u sin g h igh fr equ en cies, it is im por t a n t t o
sca le t h e fr equ en cies, dividin g by a fa ct or su ch a s h a lf t h e h igh est fr equ en cy
pr esen t in w, so a s t o obt a in well con dit ion ed va lu es of a a n d b. Th is cor r espon ds
t o a r esca lin g of t im e.
bb =
aa =
6-204
invfreqs
bbb =
aaa =
Algorithm By defa u lt , invfreqs u ses a n equ a t ion er r or m et h od t o iden t ify t h e best m odel
fr om t h e da t a . Th is fin ds b a n d a in
n
m in
b, a
∑ w t (k ) h (k )A (w (k )) – B (w (k )) 2
k =1
6-205
invfreqs
References [1] Levi, E .C. “Com plex-Cu r ve F it t in g.” IR E T ran s. on A u tom atic Con trol.
Vol. AC-4 (1959). P gs. 37-44.
[2] Den n is, J .E ., J r ., a n d R.B. Sch n a bel. N u m erical M eth od s for Un con strain ed
Optim ization an d N on lin ear E qu ation s. E n glewood Cliffs, NJ : P r en t ice H a ll,
1983.
6-206
invfreqz
Description invfreqz is t h e in ver se oper a t ion of freqz; it fin ds a discr et e-t im e t r a n sfer
fu n ct ion t h a t cor r espon ds t o a given com plex fr equ en cy r espon se. F r om a
la bor a t or y a n a lysis st a n dpoin t , invfreqz ca n be u sed t o con ver t m a gn it u de
a n d ph a se da t a in t o t r a n sfer fu n ct ion s.
B (z ) b (1 ) + b (2 )z – 1 + L+ b (n b + 1 )z – n b
H (z ) = ----------- = ----------------------------------------------------------------------------------------
-
A (z ) a (1 ) + a (2 )z – 1 + L+ a (n a + 1 )z – n a
wh ose com plex fr equ en cy r espon se is given in vect or h a t t h e fr equ en cy poin t s
specified in vect or w. Sca la r s nb a n d na specify t h e desir ed or der s of t h e
n u m er a t or a n d den om in a t or polyn om ia ls.
F r equ en cy is specified in r a dia n s bet ween 0 a n d π, a n d t h e len gt h of h m u st be
t h e sa m e a s t h e len gt h of w. invfreqz u ses conj(h) a t —w t o en su r e t h e pr oper
fr equ en cy dom a in sym m et r y for a r ea l filt er .
invfreqz(h,w,nb,na,wt,iter) a n d
6-207
invfreqz
bb =
aa =
bbb =
aaa =
Algorithm By defa u lt , invfreqz u ses a n equ a t ion er r or m et h od t o iden t ify t h e best m odel
fr om t h e da t a . Th is fin ds b a n d a in
6-208
invfreqz
m in
b, a
∑ w t (k ) h (k )A (w (k )) – B (w (k )) 2
k =1
References [1] Levi, E .C. “Com plex-Cu r ve F it t in g.” IR E T ran s. on Au tom atic Con trol.
Vol. AC-4 (1959). P gs. 37-44.
[2] Den n is, J .E ., J r ., a n d R.B. Sch n a bel. N u m erical M eth od s for Un con strain ed
Optim ization an d N on lin ear E qu ation s. E n glewood Cliffs, NJ : P r en t ice H a ll,
1983.
6-209
kaiser
Syntax w = kaiser(n,beta)
References [1] Ka iser , J .F . “Non r ecu r sive Digit a l F ilt er Design Usin g t h e I 0 - sin h Win dow
F u n ct ion .” Proc. 1974 IE E E S ym p. Circu its an d S yst. (Apr il 1974). P gs. 20-23.
[2] IE E E . Digital S ign al Processin g II. IE E E P r ess. New Yor k: J oh n Wiley &
Son s, 1975.
6-210
kaiserord
6-211
kaiserord
Algorithm kaiserord u ses em pir ica lly der ived for m u la s for est im a t in g t h e or der s of
lowpa ss filt er s, a s well a s differ en t ia t or s a n d H ilber t t r a n sfor m er s. E st im a t es
for m u lt iba n d filt er s (su ch a s ba n dpa ss filt er s) a r e der ived fr om t h e lowpa ss
design for m u la s.
Th e design for m u la s t h a t u n der lie t h e Ka iser win dow a n d it s a pplica t ion t o
F IR filt er design a r e
α – 7.95
n = ----------------------------
2.285 ( Δω )
wh er e n is t h e filt er or der a n d Δω is t h e widt h of t h e sm a llest t r a n sit ion r egion .
6-212
kaiserord
50
Magnitude (dB)
−50
−100
−150
0 0.2 0.4 0.6 0.8 1
Normalized Angular Frequency (×π rads/sample)
0
Phase (degrees)
−500
−1000
−1500
0 0.2 0.4 0.6 0.8 1
Normalized Angular Frequency (×π rads/sample)
6-213
kaiserord
1.2
0.8
0.6
0.4
0.2
0
0 500 1000 1500 2000 2500 3000 3500 4000
6-214
kaiserord
Remarks Be ca r efu l t o dist in gu ish bet ween t h e m ea n in gs of filt er len gt h a n d filt er or der .
Th e filt er len gth is t h e n u m ber of im pu lse r espon se sa m ples in t h e F IR filt er .
Gen er a lly, t h e im pu lse r espon se is in dexed fr om n = 0 t o n = L -1, wh er e L is t h e
filt er len gt h . Th e filt er ord er is t h e h igh est power in a z-t r a n sfor m
r epr esen t a t ion of t h e filt er . F or a n F IR t r a n sfer fu n ct ion , t h is r epr esen t a t ion is
a polyn om ia l in z, wh er e t h e h igh est power is z L-1 a n d t h e lowest power is z 0 .
Th e filt er or der is 1 less t h a n t h e len gt h (L -1) a n d is a lso equ a l t o t h e n u m ber
of zer os of t h e z polyn om ia l.
See Also fir1 Win dow-ba sed fin it e im pu lse r espon se filt er design –
st a n da r d r espon se.
kaiser Ka iser win dow.
remezord Pa r ks-McClella n opt im a l F IR filt er or der est im a t ion .
References [1] Ka iser , J .F . “Non r ecu r sive Digit a l F ilt er Design Usin g t h e I 0 - sin h Win dow
F u n ct ion .” P roc. 1974 IE E E S ym p. Circu its an d S yst. (Apr il 1974). P gs. 20-23.
[2] IE E E . Digital S ign al Processin g II. IE E E P r ess. New Yor k: J oh n Wiley &
Son s, 1975. P gs. 123-126.
6-215
latc2tf
num = latc2tf(k,'fir') a n d
6-216
latcfilt
See Also filter F ilt er da t a wit h a r ecu r sive (IIR) or n on r ecu r sive
(F IR) filt er.
latc2tf La t t ice filt er t o t r a n sfer fu n ct ion con ver sion .
tf2latc Con ver sion of t r a n sfer fu n ct ion t o la t t ice filt er.
6-217
levinson
Syntax a = levinson(r,p)
Description Th e Levin son -Du r bin r ecu r sion is a n a lgor it h m for fin din g a n a ll-pole IIR filt er
wit h a pr escr ibed det er m in ist ic a u t ocor r ela t ion sequ en ce. It h a s a pplica t ion s in
filt er design , codin g, a n d spect r a l est im a t ion . Th e filt er t h a t levinson pr odu ces
is m in im u m ph a se.
1 1
H (z ) = ----------- = -------------------------------------------------------------------------
-
A (z ) 1 + a (2 )z + L+ a (p + 1 )z – p
– 1
∗ ∗
r (1 ) r (2 ) L r (p ) a (2 ) – r (2 )
r (2 ) r (1 ) L r (p – 1 )
∗ a (3 ) – r (3 )
=
M O O M M M
r (p ) L r (2 ) r (1 ) a (p + 1 ) – r (p + 1 )
6-218
levinson
References [1] Lju n g, L. S ystem Id en tification : T h eory for th e User. E n glewood Cliffs, NJ :
P r en t ice H a ll, 1987. P gs. 278-280.
6-219
lp2bp
Purpose 6lp2bp
Lowpa ss t o ba n dpa ss a n a log filt er t r a n sfor m a t ion .
Description lp2bp t r a n sfor m s a n a log lowpa ss filt er pr ot ot ypes wit h a cu t off fr equ en cy of
1 r a d/sec in t o ba n dpa ss filt er s wit h desir ed ba n dwidt h a n d cen t er fr equ en cy.
Th e t r a n sfor m a t ion is on e st ep in t h e digit a l filt er design pr ocess for t h e
butter, cheby1, cheby2, a n d ellip fu n ct ion s.
b (s ) b (1 )s n b + L+ b (n b )s + b (n b + 1 )
---------- = ------------------------------------------------------------------------------------
a (s ) a (1 )s n a + L+ a (n a )s + a (n a + 1 )
Sca la r s Wo a n d Bw specify t h e cen t er fr equ en cy a n d ba n dwidt h in u n it s of
r a dia n s/secon d. F or a filt er wit h lower ba n d edge w1 a n d u pper ba n d edge w2,
u se Wo = sqrt(w1*w2) a n d Bw = w2–w1.
lp2bp r et u r n s t h e fr equ en cy t r a n sfor m ed filt er in r ow vect or s bt a n d at.
State-Space Form
6-220
lp2bp
Algorithm lp2bp is a h igh ly a ccu r a t e st a t e-spa ce for m u la t ion of t h e cla ssic a n a log filt er
fr equ en cy t r a n sfor m a t ion . Con sider t h e st a t e-spa ce syst em :
·
x = Ax + Bu
y = Cx + Du
wh er e u is t h e in pu t , x is t h e st a t e vect or , a n d y is t h e ou t pu t . Th e La pla ce
t r a n sfor m of t h e fir st equ a t ion (a ssu m in g zer o in it ia l con dit ion s) is
s X (s ) = A X (s ) + B U (s )
Now if a ba n dpa ss filt er is t o h a ve cen t er fr equ en cy ω0 a n d ba n dwidt h B w, t h e
st a n da r d s-dom a in t r a n sfor m a t ion is
s = Q (p 2 + 1 ) ⁄ p
wh er e Q = ω0/B w a n d p = s/ω0. Su bst it u t in g t h is for s in t h e La pla ce
t r a n sfor m ed st a t e-spa ce equ a t ion , a n d con sider in g t h e oper a t or p a s d /d t:
·· · ·
Qx + Qx = A x + B u
or
·· · ·
Q x –A x –B u = –Q x
Now defin e
·
Q ω = –Q x
6-221
lp2bp
6-222
lp2bs
Purpose 6lp2bs
Lowpa ss t o ba n dst op a n a log filt er t r a n sfor m a t ion .
Description lp2bs t r a n sfor m s a n a log lowpa ss filt er pr ot ot ypes wit h a cu t off fr equ en cy of
1 r a d/sec in t o ba n dst op filt er s wit h desir ed ba n dwidt h a n d cen t er fr equ en cy.
Th e t r a n sfor m a t ion is on e st ep in t h e digit a l filt er design pr ocess for t h e
butter, cheby1, cheby2, a n d ellip fu n ct ion s.
b (s ) b (1 )s n b + L+ b (n b )s + b (n b + 1 )
---------- = ------------------------------------------------------------------------------------
a (s ) a (1 )s n a + L+ a (n a )s + a (n a + 1 )
Sca la r s Wo a n d Bw specify t h e cen t er fr equ en cy a n d ba n dwidt h in u n it s of
r a dia n s/secon d. F or a filt er wit h lower ba n d edge w1 a n d u pper ba n d edge w2,
u se Wo = sqrt(w1*w2) a n d Bw = w2–w1.
lp2bs r et u r n s t h e fr equ en cy t r a n sfor m ed filt er in r ow vect or s bt a n d at.
State-Space Form
6-223
lp2bs
Algorithm lp2bs is a h igh ly a ccu r a t e st a t e-spa ce for m u la t ion of t h e cla ssic a n a log filt er
fr equ en cy t r a n sfor m a t ion . If a ba n dst op filt er is t o h a ve cen t er fr equ en cy ω0
a n d ba n dwidt h B w, t h e st a n da r d s-dom a in t r a n sfor m a t ion is
p
s = ------------------------
2
Q (p + 1 )
wh er e Q = ω0/B w a n d p = s/ω0. Th e st a t e-spa ce ver sion of t h is t r a n sfor m a t ion is
Q = Wo/Bw;
At = [Wo/Q*inv(A) Wo*eye(ma);–Wo*eye(ma) zeros(ma)];
Bt = –[Wo/Q*(A B); zeros(ma,nb)];
Ct = [C/A zeros(mc,ma)];
Dt = D – C/A*B;
See lp2bp for a der iva t ion of t h e ba n dpa ss ver sion of t h is t r a n sfor m a t ion .
6-224
lp2hp
Purpose 6lp2h p
Lowpa ss t o h igh pa ss a n a log filt er t r a n sfor m a t ion .
Description lp2hp t r a n sfor m s a n a log lowpa ss filt er pr ot ot ypes wit h a cu t off fr equ en cy of
1 r a d/sec in t o h igh pa ss filt er s wit h desir ed cu t off fr equ en cy. Th e
t r a n sfor m a t ion is on e st ep in t h e digit a l filt er design pr ocess for t h e butter,
cheby1, cheby2, a n d ellip fu n ct ion s.
b (s ) b (1 )s n b + L+ b (n b )s + b (n b + 1 )
---------- = ------------------------------------------------------------------------------------
a (s ) a (1 )s n a + L+ a (n a )s + a (n a + 1 )
Sca la r Wo specifies t h e cu t off fr equ en cy in u n it s of r a dia n s/secon d. Th e
fr equ en cy t r a n sfor m ed filt er is r et u r n ed in r ow vect or s bt a n d at.
State-Space Form
6-225
lp2hp
Algorithm lp2hp is a h igh ly a ccu r a t e st a t e-spa ce for m u la t ion of t h e cla ssic a n a log filt er
fr equ en cy t r a n sfor m a t ion . If a h igh pa ss filt er is t o h a ve cu t off fr equ en cy ω0, t h e
st a n da r d s-dom a in t r a n sfor m a t ion is
ω0
s = -------
p
Th e st a t e-spa ce ver sion of t h is t r a n sfor m a t ion is
At = Wo*inv(A);
Bt = –Wo*(A\B);
Ct = C/A;
Dt = D – C/A*B;
See lp2bp for a der iva t ion of t h e ba n dpa ss ver sion of t h is t r a n sfor m a t ion .
6-226
lp2lp
Purpose 6lp2lp
Lowpa ss t o lowpa ss a n a log filt er t r a n sfor m a t ion .
Description lp2lp t r a n sfor m s a n a n a log lowpa ss filt er pr ot ot ype wit h a cu t off fr equ en cy of
1 r a d/sec in t o a lowpa ss filt er wit h a n y specified cu t off fr equ en cy. Th e
t r a n sfor m a t ion is on e st ep in t h e digit a l filt er design pr ocess for t h e butter,
cheby1, cheby2, a n d ellip fu n ct ion s.
b (s ) b (1 )s n b + L+ b (n b )s + b (n b + 1 )
---------- = ------------------------------------------------------------------------------------
a (s ) a (1 )s n a + L+ a (n a )s + a (n a + 1 )
Sca la r Wo specifies t h e cu t off fr equ en cy in u n it s of r a dia n s/secon d. lp2lp
r et u r n s t h e fr equ en cy t r a n sfor m ed filt er in r ow vect or s bt a n d at.
State-Space Form
6-227
lp2lp
Algorithm lp2lp is a h igh ly a ccu r a t e st a t e-spa ce for m u la t ion of t h e cla ssic a n a log filt er
fr equ en cy t r a n sfor m a t ion . If a lowpa ss filt er is t o h a ve cu t off fr equ en cy ω0, t h e
st a n da r d s-dom a in t r a n sfor m a t ion is
s = p ⁄ ω0
See lp2bp for a der iva t ion of t h e ba n dpa ss ver sion of t h is t r a n sfor m a t ion .
6-228
lpc
Purpose 6lpc
Lin ea r pr edict ion coefficien t s.
Syntax a = lpc(x,p)
x̂ (n ) = – a (2 )x (n – 1 ) –a (3 )x (n – 2 ) – L– a (p + 1 )x (n – p )
p is t h e or der of t h e pr edict ion polyn om ia l, a = [1 a(2) ... a(p+1)].
6-229
lpc
–1 –2 –p x̂ ( n )
x (n ) – a ( 2 )z – a ( 3 )z – L– a ( n e(n )
H (z ) = + 1 )z
– Σ
+
A (z )
Com pa r e t h e pr edict ed sign a l t o t h e or igin a l sign a l.
plot(1:97,x(4001:4097),1:97,est_x(4001:4097),'--');
title('Original Signal vs. LPC Estimate');
xlabel('Samples'); ylabel('Amplitude'); grid;
legend('Original Signal','LPC Estimate')
1
Amplitude
−1
−2
−3
Original Signal
LPC Estimate
−4
0 20 40 60 80 100
Samples
6-230
lpc
0.8
Normalized Value
0.6
0.4
0.2
−0.2
−5000 0 5000
Lags
Algorithm lpc u ses t h e a u t ocor r ela t ion m et h od of a u t or egr essive (AR) m odelin g t o fin d
t h e filt er coefficien t s. Th e gen er a t ed filt er m igh t n ot m odel t h e pr ocess exa ct ly
even if t h e da t a sequ en ce is t r u ly a n AR pr ocess of t h e cor r ect or der . Th is is
beca u se t h e a u t ocor r ela t ion m et h od im plicit ly win dows t h e da t a , t h a t is, it
a ssu m es t h a t sign a l sa m ples beyon d t h e len gt h of x a r e 0.
lpc com pu t es t h e lea st -squ a r es solu t ion t o
Xa ≈ b
wh er e
x (1 ) 0 L 0
x (2 ) x (1 ) O M
1 1
M x (2 ) O 0
a (2 ) 0
X = x (m ) M Ox (1 ) , a = , b=
M M
0 x (m ) Ox (2 )
a (p + 1 ) 0
M O O M
0 L 0 x (m )
6-231
lpc
XHXa = XHb
lea ds t o t h e Yu le-Wa lker equ a t ion s
r (1 ) r (2 )* L r (p )* a (2 ) – r (2 )
r (2 ) r (1 ) O M a (3 ) – r (3 )
=
M O O r (2 )* M M
r (p ) L r (2 ) r (1 ) a (p + 1 ) – r (p + 1 )
wh er e r = [r(1) r(2) ... r(p+1)] is a n a u t ocor r ela t ion est im a t e for x com pu t ed
u sin g xcorr. Th e Yu le-Wa lker equ a t ion s a r e solved in O(p 2 ) flops by t h e
Levin son -Du r bin a lgor it h m (see levinson).
References [1] J a ckson , L.B. Digital Filters an d S ign al Processin g. Secon d E d. Bost on :
Klu wer Aca dem ic P u blish er s, 1989. P gs. 255-257.
6-232
maxflat
Purpose 6m a xfla t
Gen er a lized digit a l Bu t t er wor t h filt er design .
6-233
maxflat
0.5
0
0 0.2 0.4 0.6 0.8 1
Pole-zero plot w/p Group delay
5
1
4
0.5 Samples
3
Imag
0 <- deg 4
2
-0.5
1
-1
0
-1 0 1 0 0.5 1
Real w/p
References [1] Selesn ick, I.W., a n d C.S. Bu r r u s. “Gen er a lized Digit a l Bu t t er wor t h F ilt er
Design .” Proceed in gs of th e IE E E In t. Con f. Acou st., S peech , S ign al Processin g.
Vol. 3 (Ma y 1996).
6-234
medfilt1
Purpose 6m edfilt 1
On e-dim en sion a l m edia n filt er in g.
Syntax y = medfilt1(x,n)
y = medfilt1(x,n,blksz)
Th e defa u lt for n is 3.
See Also filter F ilt er da t a wit h a r ecu r sive (IIR) or n on r ecu r sive
(F IR) filt er.
medfilt2 Two-dim en sion a l m edia n filt er in g (see Im age
Processin g T oolbox User’s Gu id e).
median Media n va lu e (see t h e on lin e M AT L AB Fu n ction
R eferen ce).
References [1] P r a t t , W.K. Digital Im age Processin g. New Yor k: J oh n Wiley & Son s, 1978.
P gs. 330-333.
6-235
modulate
Purpose 6m odu la t e
Modu la t ion for com m u n ica t ion s sim u la t ion .
Syntax y = modulate(x,Fc,Fs,'method')
y = modulate(x,Fc,Fs,'method',opt)
[y,t] = modulate(x,Fc,Fs)
Description y = modulate(x,Fc,Fs,'method') a n d
6-236
modulate
6-237
modulate
See Also demod Dem odu la t ion for com m u n ica t ion s sim u la t ion .
vco Volt a ge con t r olled oscilla t or.
6-238
pburg
Purpose 6pbu rg
P ower spect r u m est im a t e u sin g t h e Bu r g m et h od.
Description pburg est im a t es t h e power spect r a l den sit y (P SD) of t h e sign a l vect or x[n ]
u sin g t h e Bu r g m et h od. Th is m et h od fit s a n a u t or egr essive (AR) m odel t o t h e
sign a l by m in im izin g (lea st squ a r es) t h e for wa r d a n d ba ckwa r d pr edict ion
er r or s wh ile con st r a in in g t h e AR pa r a m et er s t o sa t isfy t h e Levin son -Du r bin
r ecu r sion . Th e spect r a l est im a t e r et u r n ed by pburg is t h e m a gn it u de squ a r ed
fr equ en cy r espon se of t h is AR m odel. Th e cor r ect ch oice of t h e m odel or der p is
im por t a n t .
6-239
pburg
30
20
Magnitude (dB)
10
−10
−20
0 0.2 0.4 0.6 0.8 1
Normalized Angular Frequency (×π rads/sample)
6-240
pburg
30
Power Spectral Density (dB)
20
10
−10
−20
0 0.2 0.4 0.6 0.8 1
Normalized Angular Frequency (×π rads/sample)
6-241
pburg
References [1] Ma r ple, S.L. Digital S pectral A n alysis. E n glewood Cliffs, NJ : P r en t ice H a ll,
1987. Ch a pt er 7.
6-242
pcov
Purpose 6pcov
P ower spect r u m est im a t e u sin g t h e cova r ia n ce m et h od.
Description pcov est im a t es t h e power spect r a l den sit y (P SD) of t h e sign a l vect or x[n ] u sin g
t h e cova r ia n ce m et h od. Th is m et h od fit s a n a u t or egr essive (AR) m odel t o t h e
sign a l by m in im izin g t h e for wa r d pr edict ion er r or in t h e lea st -squ a r es sen se.
Th e spect r a l est im a t e r et u r n ed by pcov is t h e m a gn it u de squ a r ed fr equ en cy
r espon se of t h is AR m odel. Th e cor r ect ch oice of t h e m odel or der p is im por t a n t .
6-243
pcov
pcov(...) plot s t h e power spect r a l den sit y in t h e fir st a va ila ble figu r e win dow.
Th e fr equ en cy r a n ge on t h e plot is t h e sa m e a s t h e r a n ge of ou t pu t freq for a
given set of pa r a m et er s.
30
20
Magnitude (dB)
10
−10
−20
0 0.2 0.4 0.6 0.8 1
Normalized Angular Frequency (×π rads/sample)
6-244
pcov
30
Power Spectral Density (dB)
20
10
−10
−20
0 0.2 0.4 0.6 0.8 1
Normalized Angular Frequency (×π rads/sample)
6-245
pcov
References [1] Ma r ple, S.L. Digital S pectral A n alysis. E n glewood Cliffs, NJ : P r en t ice H a ll,
1987. Ch a pt er 7.
6-246
pmcov
Description pmcov est im a t es t h e power spect r a l den sit y (P SD) of t h e sign a l vect or x[n ]
u sin g t h e m odified cova r ia n ce m et h od. Th is m et h od fit s a n a u t or egr essive (AR)
m odel t o t h e sign a l by m in im izin g t h e for wa r d a n d ba ckwa r d pr edict ion er r or s
in t h e lea st -squ a r es sen se. Th e spect r a l est im a t e r et u r n ed by pmcov is t h e
m a gn it u de squ a r ed fr equ en cy r espon se of t h is AR m odel. Th e cor r ect ch oice of
t h e m odel or der p is im por t a n t .
6-247
pmcov
pmcov(...) plot s t h e power spect r a l den sit y in t h e fir st a va ila ble figu r e
win dow. Th e fr equ en cy r a n ge on t h e plot is t h e sa m e a s t h e r a n ge of ou t pu t
freq for a given set of pa r a m et er s.
30
20
Magnitude (dB)
10
−10
−20
0 0.2 0.4 0.6 0.8 1
Normalized Angular Frequency (×π rads/sample)
6-248
pmcov
30
Power Spectral Density (dB)
20
10
−10
−20
−30
0 0.2 0.4 0.6 0.8 1
Normalized Angular Frequency (×π rads/sample)
6-249
pmcov
References [1] Ma r ple, S.L. Digital S pectral A n alysis. E n glewood Cliffs, NJ : P r en t ice H a ll,
1987. Ch a pt er 7.
6-250
pmtm
Purpose 6pm t m
P ower spect r u m est im a t e u sin g t h e m u lt it a per m et h od (MTM).
Description pmtm est im a t es t h e power spect r a l den sit y (P SD) of t h e r ea l t im e ser ies x u sin g
t h e m u lt it a per m et h od (MTM), descr ibed in [1].
6-251
pmtm
[Pxx,Pxxc,f] = pmtm(x,e,v,nfft,Fs,'method',p) r et u r n s t h e P SD
est im a t e Pxx, t h e con fiden ce in t er va l Pxxc, a n d t h e fr equ en cy vect or f fr om t h e
da t a t a per s in e a n d t h eir con cen t r a t ion s v.
[Pxx,Pxxc,f] = pmtm(x,dpss_params,nfft,Fs,'method',p) r et u r n s t h e
P SD est im a t e Pxx, t h e con fiden ce in t er va l Pxxc, a n d t h e fr equ en cy vect or f
fr om t h e da t a t a per s com pu t ed u sin g dpss wit h pa r a m et er s fr om t h e cell a r r a y
dpss_params, wh ose fir st elem en t is t h e secon d in pu t t o dpss. Th e fir st dpss
pa r a m et er (n) is det er m in ed by t h e len gt h of x. F or exa m ple,
pmtm(x,{3.5,'trace'},512,Fs) ca lcu la t es t h e Slepia n sequ en ces for nw = 3.5,
a n d displa ys t h e m et h od t h a t dpss u ses. See dpss for ot h er opt ion s.
6-252
pmtm
20
15
10
-5
-10
0 100 200 300 400 500
See Also dpss Discr et e pr ola t e sph er oida l sequ en ces (Slepia n
sequ en ces).
pburg Power spect r u m est im a t e u sin g t h e Bu r g m et h od.
pcov Power spect r u m est im a t e u sin g t h e cova r ia n ce
m et h od.
pmcov Power spect r u m est im a t e u sin g t h e m odified
cova r ia n ce m et h od.
pmusic Power spect r u m est im a t e u sin g MUSIC eigen vect or
m et h od.
pwelch E st im a t e t h e power spect r a l den sit y (P SD) of a sign a l
u sin g Welch ’s m et h od.
pyulear Power spect r u m est im a t e u sin g Yu le-Wa lker AR
m et h od.
6-253
pmtm
References [1] P er civa l, D.B., a n d A.T. Wa lden . S pectral A n alysis for Ph ysical
Application s: M u ltitaper an d Con ven tion al Un ivariate T ech n iqu es. Ca m br idge:
Ca m br idge Un iver sit y P r ess, 1993.
[2] Th om son , D.J . “Spect r u m est im a t ion a n d h a r m on ic a n a lysis.” In
Proceed in gs of th e IE E E . Vol. 70 (1982). P gs. 1055-1096.
6-254
pmusic
Description pmusic est im a t es t h e power spect r a l den sit y (P SD) of a sign a l or cor r ela t ion
m a t r ix u sin g Sch m idt ’s eigen -a n a lysis m et h od [1]. Th e n a m e MUSIC is a n
a cr on ym for MUlt iple SIgn a l Cla ssifica t ion . Th e eigen vector m eth od , wh ich
u ses eigen va lu e weigh t in g, is a lso su ppor t ed [2]. Th e ca llin g syn t a x is sim ila r
t o t h a t of pwelch, wh ich a lso per for m s spect r u m est im a t ion . pwelch u ses t h e
cla ssica l F F T-ba sed a ppr oa ch wh ile pmusic per for m s eigen -a n a lysis of t h e
sign a l’s cor r ela t ion m a t r ix.
[Pxx,f] = pmusic(x,p) a n d
6-255
pmusic
6-256
pmusic
6-257
pmusic
[PP,ff,v_noise] = pmusic(xx,4);
for kk = 1:size(v_noise,2)
rr(:,kk) = roots(v_noise(:,kk));
end
zplane(rr)
1 1
P music(f ) = ---------------------------------------------------------------
N
- = ------------------------------------------
N -
⎛ ⎞
e H (f ) ⎜ ∑ v k v kH ⎟ e (f ) ∑ v kH e (f ) 2
⎜ ⎟
⎝ k = p + 1 ⎠ k = p +1
6-258
pmusic
v kH e (f )
1
P ev (f ) = ----------------------------------------------------------
N
-
⎛ ⎞
⎜ v kH e (f ) 2⎟ ⁄ λ k
⎜ ∑ ⎟
⎝ k = p + 1 ⎠
6-259
pmusic
If t h e secon d a r gu m en t wa s en t er ed a s a n em pt y m a t r ix, or if it h a s m or e t h a n
t wo elem en t s, or if it h a s n ega t ive or n on -in t eger elem en t s, pmusic gives on e of
t h e followin g er r or m essa ges:
P cannot be empty.
Second input must have only 1 or 2 elements.
P must be an integer.
Second input must contain non-negative entries.
6-260
pmusic
References [1] Sch m idt , R.O. “Mu lt iple E m it t er Loca t ion a n d Sign a l P a r a m et er
E st im a t ion .” IE E E T ran s. An ten n as Propagation . Vol. AP -34 (Ma r ch 1986).
P gs. 276-280.
[2] Ma r ple, S.L. Digital S pectral A n alysis. E n glewood Cliffs, NJ : P r en t ice H a ll,
1987. P gs. 373-378.
6-261
poly2ac
Purpose 6poly2a c
Con ver sion of pr edict ion polyn om ia l t o a u t ocor r ela t ion sequ en ce.
Syntax r = poly2ac(a,efinal)
Description r = poly2ac(a,efinal) fin ds t h e a u t ocor r ela t ion sequ en ce cor r espon din g t o
pr edict ion polyn om ia l a a n d fin a l pr edict ion er r or efinal. If a(1) is n ot equ a l
t o 1, poly2ac n or m a lizes t h e pr edict ion polyn om ia l by a(1). a(1) ca n n ot be 0.
See Also ac2poly Con ver sion of a u t ocor r ela t ion sequ en ce t o pr edict ion
polyn om ia l.
poly2rc Con ver sion of pr edict ion polyn om ia l t o r eflect ion
coefficien t s.
rc2ac Con ver sion of r eflect ion coefficien t s t o
a u t ocor r ela t ion sequ en ce.
6-262
poly2rc
Purpose 6poly2r c
Con ver sion of pr edict ion polyn om ia l t o r eflect ion coefficien t s.
Syntax k = poly2rc(a)
[k,r0] = poly2rc(a,efinal)
k =
0.3090
0.9801
0.0031
0.0081
–0.0082
6-263
poly2rc
k (n ) = a n (n )
a n (m ) – k (n )a n (n – m )
a n – 1 (m ) = ---------------------------------------------------------- , m = 1 , 2 , …, n – 1
1 – k (n ) 2
Th is r ela t ion sh ip is ba sed on Levin son ’s r ecu r sion [1]. To im plem en t it ,
poly2rc loops t h r ou gh a in r ever se or der a ft er disca r din g it s fir st elem en t . F or
ea ch loop it er a t ion i, t h e fu n ct ion
See Also ac2rc Con ver sion of a u t ocor r ela t ion sequ en ce t o r eflect ion
coefficien t s.
latc2tf La t t ice filt er t o t r a n sfer fu n ct ion con ver sion .
latcfilt La t t ice a n d la t t ice-la dder filt er im plem en t a t ion .
poly2ac Con ver sion of pr edict ion polyn om ia l t o
a u t ocor r ela t ion sequ en ce.
rc2poly Con ver sion of r eflect ion coefficien t s t o pr edict ion
polyn om ia l.
tf2latc Con ver sion of t r a n sfer fu n ct ion t o la t t ice filt er.
References [1] Ka y, S.M. M od ern S pectral E stim ation : T h eory an d Application . E n glewood
Cliffs, NJ : P r en t ice H a ll, 1988.
6-264
polystab
Purpose 6polyst a b
St a bilize polyn om ia l.
Syntax b = polystab(a)
Description polystab st a bilizes a polyn om ia l wit h r espect t o t h e u n it cir cle; it r eflect s r oot s
wit h m a gn it u des gr ea t er t h a n 1 in side t h e u n it cir cle.
a (z ) = a (1 ) + a (2 )z – 1 + L+ a (n a + 1 )z – n a
r et u r n s a r ow vect or con t a in in g t h e st a bilized polyn om ia l.
Example polystab ca n con ver t a lin ea r -ph a se filt er in t o a m in im u m -ph a se filt er wit h
t h e sa m e m a gn it u de r espon se:
h = fir1(25,0.4);
hmin = polystab(h)*norm(h)/norm(polystab(h));
6-265
prony
Purpose 6pr on y
P r on y’s m et h od for t im e dom a in IIR filt er design .
Description P r on y’s m et h od is a n a lgor it h m for fin din g a n IIR filt er wit h a pr escr ibed t im e
dom a in im pu lse r espon se. It h a s a pplica t ion s in filt er design , expon en t ia l
sign a l m odelin g, a n d syst em iden t ifica t ion (pa r a m et r ic m odelin g).
B (z ) b (1 ) + b (2 )z – 1 + L+ b (n b + 1 )z – n b
H (z ) = ----------- = ----------------------------------------------------------------------------------------
-
A (z ) a (1 ) + a (2 )z – 1 + L+ a (n a + 1 )z –n a
b =
0.0048 0.0193 0.0289 0.0193 0.0048
a =
1.0000 –2.3695 2.3140 –1.0547 0.1874
h = filter(b,a,[1 zeros(1,25)]);
[bb,aa] = prony(h,4,4)
bb =
0.0048 0.0193 0.0289 0.0193 0.0048
ab =
1.0000 –2.3695 2.3140 –1.0547 0.1874
6-266
prony
References [1] P a r ks, T.W., a n d C.S. Bu r r u s. Digital Filter Design . New Yor k: J oh n Wiley
& Son s, 1987. P gs. 226-228.
6-267
psd
6-268
pulstran
Syntax y = pulstran(t,d,'func')
y = pulstran(t,d,'func',p1,p2,...)
y = pulstran(t,d,p,Fs)
y = pulstran(t,d,p)
6-269
pulstran
Examples Th is exa m ple gen er a t es a n a sym m et r ic sa wt oot h wa vefor m wit h a r epet it ion
fr equ en cy of 3 H z a n d a sa wt oot h widt h of 0.1 sec. It h a s a sign a l len gt h of 1 sec
a n d a 1 k H z sa m ple r a t e:
t = 0 : 1/1e3 : 1; % 1 kHz sample freq for 1 sec
d = 0 : 1/3 : 1; % 3 Hz repetition freq
y = pulstran(t,d,'tripuls',0.1,–1);
plot(t,y)
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0
0 0.2 0.4 0.6 0.8 1
Th is exa m ple gen er a t es a per iodic Ga u ssia n pu lse sign a l a t 10 k H z, wit h 50%
ba n dwidt h . Th e pu lse r epet it ion fr equ en cy is 1 k H z, sa m ple r a t e is 50 k H z, a n d
6-270
pulstran
0.8
0.6
0.4
0.2
-0.2
-0.4
-0.6
-0.8
0 0.002 0.004 0.006 0.008 0.01
6-271
pulstran
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0
0 50 100 150 200 250 300 350
6-272
pwelch
Purpose 6pwelch
E st im a t e t h e power spect r a l den sit y (P SD) of a sign a l u sin g Welch ’s m et h od.
6-273
pwelch
[Pxx,Pxxc,f] = pwelch(x,nfft,Fs,window,noverlap,p) wh er e p is a
posit ive sca la r bet ween 0 a n d 1 r et u r n s a vect or Pxxc t h a t con t a in s a n est im a t e
of t h e p*100 per cen t con fiden ce in t er va l for Pxx. Pxxc is a t wo-colu m n m a t r ix
t h a t is t h e sa m e len gt h a s Pxx. Th e in t er va l [Pxxc(:,1),Pxxc(:,2)] cover s t h e
t r u e P SD wit h pr oba bilit y p. plot(f,[Pxx Pxxc]) plot s t h e power spect r u m
in side t h e p*100 per cen t con fiden ce in t er va l. Specify a n em pt y m a t r ix for p, [],
t o u se t h e defa u lt va lu e of 0.95.
6-274
pwelch
−40
−50
Power Spectral Density (dB)
−60
−70
−80
−90
−100
−110
0 1000 2000 3000 4000 5000
Frequency (Hz)
Algorithm pwelch ca lcu la t es t h e power spect r a l den sit y u sin g Welch ’s m et h od (see
r efer en ces [1] a n d [2]):
6-275
pwelch
4 It a ver a ges t h e per iodogr a m s of t h e over la ppin g sect ion s t o for m Pxx(f).
5 It sca les Pxx(f) by 1/Fs t o for m Pxx(f)/Fs, t h e power spect r u m of x.
Diagnostics An a ppr opr ia t e dia gn ost ic m essa ge is displa yed wh en in cor r ect a r gu m en t s t o
pwelch a r e u sed:
6-276
pwelch
6-277
pyulear
Description pyulear est im a t es t h e power spect r a l den sit y (P SD) of t h e sign a l vect or x[n ]
u sin g t h e Yu le-Wa lk er AR m et h od. Th is m et h od, a lso ca lled t h e
a u t ocor r ela t ion m et h od, fit s a n a u t or egr essive (AR) m odel t o t h e sign a l by
m in im izin g t h e for wa r d pr edict ion er r or in t h e lea st -squ a r es sen se. Th is
for m u la t ion lea ds t o t h e Yu le-Wa lker equ a t ion s, wh ich a r e solved by t h e
Levin son -Du r bin r ecu r sion . Th e spect r a l est im a t e r et u r n ed by pyulear is t h e
m a gn it u de squ a r ed fr equ en cy r espon se of t h is AR m odel. Th e cor r ect ch oice of
t h e m odel or der p is im por t a n t .
6-278
pyulear
pyulear(...) plot s t h e power spect r a l den sit y in t h e fir st a va ila ble figu r e
win dow. Th e fr equ en cy r a n ge on t h e plot is t h e sa m e a s t h e r a n ge of ou t pu t
freq for a given set of pa r a m et er s.
30
20
Magnitude (dB)
10
−10
−20
0 0.2 0.4 0.6 0.8 1
Normalized Angular Frequency (×π rads/sample)
6-279
pyulear
20
Power Spectral Density (dB)
15
10
−5
−10
0 0.2 0.4 0.6 0.8 1
Normalized Angular Frequency (×π rads/sample)
6-280
pyulear
References [1] Ma r ple, S.L. Digital S pectral A n alysis. E n glewood Cliffs, NJ : P r en t ice H a ll,
1987. Ch a pt er 7.
6-281
rc2ac
Purpose 6rc2a c
Con ver sion of r eflect ion coefficien t s t o a u t ocor r ela t ion sequ en ce.
Syntax r = rc2ac(k,r0)
See Also ac2rc Con ver sion of a u t ocor r ela t ion sequ en ce t o r eflect ion
coefficien t s.
poly2ac Con ver sion of pr edict ion polyn om ia l t o
a u t ocor r ela t ion sequ en ce.
rc2poly Con ver sion of r eflect ion coefficien t s t o pr edict ion
polyn om ia l.
6-282
rc2poly
Purpose 6rc2poly
Con ver sion of r eflect ion coefficien t s t o pr edict ion polyn om ia l.
Syntax a = rc2poly(k)
[a,efinal] = rc2poly(k,r0)
a =
Algorithm rc2poly com pu t es ou t pu t a u sin g Levin son ’s r ecu r sion [1]. Th e fu n ct ion :
6-283
rc2poly
See Also ac2poly Con ver sion of a u t ocor r ela t ion sequ en ce t o pr edict ion
polyn om ia l.
latc2tf La t t ice filt er t o t r a n sfer fu n ct ion con ver sion .
latcfilt La t t ice a n d la t t ice-la dder filt er im plem en t a t ion .
poly2rc Con ver sion of pr edict ion polyn om ia l t o r eflect ion
coefficien t s.
rc2ac Con ver sion of r eflect ion coefficien t s t o
a u t ocor r ela t ion sequ en ce.
tf2latc Con ver sion of t r a n sfer fu n ct ion t o la t t ice filt er.
6-284
rceps
Purpose 6rceps
Rea l cepst r u m a n d m in im u m ph a se r econ st r u ct ion .
Syntax y = rceps(x)
[y,ym] = rceps(x)
y = real(ifft(log(abs(fft(x)))));
References [1] Oppen h eim , A.V., a n d R.W. Sch a fer . Digital S ign al Processin g. E n glewood
Cliffs, NJ : P r en t ice H a ll, 1975.
[2] IE E E . Program s for Digital S ign al Processin g. IE E E P r ess. New Yor k: J oh n
Wiley & Son s, 1979.
6-285
rectpuls
Purpose 6rect pu ls
Sa m pled a per iodic r ect a n gle gen er a t or .
Syntax y = rectpuls(t)
y = rectpuls(t,w)
6-286
remez
Purpose 6rem ez
P a r ks-McClella n opt im a l F IR filt er design .
Syntax b = remez(n,f,a)
b = remez(n,f,a,w)
b = remez(n,f,a,'ftype')
b = remez(n,f,a,w,'ftype')
b = remez(...,{lgrid})
b = remez(n,f,'fresp',w)
b = remez(n,f,'fresp',w,'ftype')
b = remez(n,f,{'fresp',p1,p2,...},w)
b = remez(n,f,{'fresp',p1,p2,...},w,'ftype')
[b,delta] = remez(...)
[b,delta,opt] = remez(...)
b (k ) = b (n + 2 – k ), k = 1 , …, n + 1
Vect or s f a n d a specify t h e fr equ en cy-m a gn it u de ch a r a ct er ist ics of t h e filt er :
6-287
remez
Desired amplitude
response (a) 1.0
0.5
Normalized
0.0 frequency (f)
0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 (Nyquist)
b = remez(n,f,a,'ftype') a n d
6-288
remez
• hilbert, for lin ea r -ph a se filt er s wit h odd sym m et r y (t ype III a n d t ype IV)
Th e ou t pu t coefficien t s in b obey t h e r ela t ion b(k ) = -b(n + 2 -k ), k = 1,...,n + 1.
Th is cla ss of filt er s in clu des t h e H ilber t t r a n sfor m er , wh ich h a s a desir ed
a m plit u de of 1 a cr oss t h e en t ir e ba n d.
F or exa m ple,
h = remez(30,[0.1 0.9],[1 1],'hilbert');
• n is t h e filt er or der .
• f is t h e vect or of fr equ en cy ba n d edges t h a t a ppea r m on ot on ica lly bet ween
0 a n d 1, wh er e 1 is t h e Nyqu ist fr equ en cy.
• gf is a vect or of gr id poin t s t h a t h a ve been lin ea r ly in t er pola t ed over ea ch
specified fr equ en cy ba n d by remez. gf det er m in es t h e fr equ en cy gr id a t
6-289
remez
b = remez(n,f,'fresp',w,'ftype') a n d
6-290
remez
opt.fgrid F r equ en cy gr id vect or u sed for t h e filt er design opt im iza t ion
opt.des Desir ed fr equ en cy r espon se for ea ch poin t in opt.fgrid
opt.wt Weigh t in g for ea ch poin t in opt.fgrid
opt.H Act u a l fr equ en cy r espon se for ea ch poin t in opt.fgrid
opt.error E r r or a t ea ch poin t in opt.fgrid (opt.des–opt.H)
opt.iextr Vect or of in dices in t o opt.fgrid for ext r em a l fr equ en cies
opt.fextr Vect or of ext r em a l fr equ en cies
1.2
0.8
0.6
0.4
0.2
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
6-291
remez
Linear
Phase Filter Response H(f), Response H(f),
Filter Type Order n Symmetry of Coefficients f=0 f = 1 (Nyquist)
Diagnostics An a ppr opr ia t e dia gn ost ic m essa ge is displa yed if in cor r ect a r gu m en t s a r e
u sed:
Filter order must be 3 or more.
There should be one weight per band.
Frequency and amplitude vectors must be the same length.
The number of frequency points must be even.
Frequencies must lie between 0 and 1.
Frequencies must be specified in bands.
Frequencies must be nondecreasing.
Adjacent bands not allowed.
6-292
remez
References [1] IE E E . Program s for Digital S ign al Processin g. IE E E P r ess. New Yor k: J oh n
Wiley & Son s, 1979. Algor it h m 5.1.
[2] IE E E . S elected Papers in Digital S ign al Processin g, II. IE E E P r ess. New
Yor k : J oh n Wiley & Son s, 1979.
[3] P a r ks, T.W., a n d C.S. Bu r r u s. Digital Filter Design . New Yor k: J oh n Wiley
& Son s, 1987. P g. 83.
[4] Ra bin er , L.R., J .H . McClella n , a n d T.W. P a r ks. “F IR Digit a l F ilt er Design
Tech n iqu es Usin g Weigh t ed Ch ebysh ev Appr oxim a t ion s.” Proc. IE E E 63
(1975).
[5] Oppen h eim , A.V., a n d R.W. Sch a fer . Discrete-T im e S ign al Processin g.
E n glewood Cliffs, NJ : P r en t ice H a ll, 1989. P gs. 256-266.
6-293
remezord
Use remez wit h t h e r esu lt in g or der n, fr equ en cy vect or fo, a m plit u de r espon se
vect or ao, a n d weigh t s w t o design t h e filt er b wh ich a ppr oxim a t ely m eet s t h e
specifica t ion s given by remezord in pu t pa r a m et er s f, a, a n d dev:
b = remez(n,fo,ao,w)
Examples Design a m in im u m -or der lowpa ss filt er wit h a 500 H z pa ssba n d cu t off
fr equ en cy a n d 600 H z st opba n d cu t off fr equ en cy, wit h a sa m plin g fr equ en cy of
6-294
remezord
% compute deviations
dev = [(10^(rp/20)–1)/(10^(rp/20)+1) 10^(–rs/20)];
[n,fo,ao,w] = remezord(f,a,dev,Fs);
b = remez(n,fo,ao,w);
[h,f] = freqz(b,1,1024,Fs);
plot(f,20*log10(abs(h)));
-10
Magnitude (dB)
-20
-30
-40
-50
-60
0 100 200 300 400 500 600 700 800 900 1000
Frequency (Hz)
6-295
remezord
6-296
remezord
6-297
resample
Syntax y = resample(x,p,q)
y = resample(x,p,q,n)
y = resample(x,p,q,n,beta)
y = resample(x,p,q,b)
[y,b] = resample(x,p,q)
6-298
resample
1.5
original
resampled
0.5
−0.5
−0.5 0 0.5 1 1.5
Time
6-299
resample
0
0 5 10 15 20
Edge Effects Very Noticeable
15
10
5
original
resampled
0
0 5 10 15 20
6-300
resample
6-301
residuez
Purpose 6residu ez
z-t r a n sfor m pa r t ia l-fr a ct ion expa n sion .
b (z ) = b 0 + b 1 z –1 + b 2 z – 2 + L+ b m z – m
a (z ) = a 0 + a 1 z – 1 + a 2 z – 2 + L+ a n z – n
b (z ) r (1 ) r (n )
---------- = ----------------------------
– 1
- + k (1 ) + k (2 )z – 1 + L+ k (m – n + 1 )z – ( m
+ L+ ---------------------------- – n)
a (z ) 1 – p (1 )z 1 – p (n )z – 1
Th e r et u r n ed colu m n vect or r con t a in s t h e r esidu es, colu m n vect or p con t a in s
t h e pole loca t ion s, a n d r ow vect or k con t a in s t h e dir ect t er m s. Th e n u m ber of
poles is
n = length(a)–1 = length(r) = length(p)
r (j ) r (j + 1 ) r (j + s r – 1 )
--------------------------
– 1 2
- + L+ -----------------------------------
- + ---------------------------------- -
1 – p (j )z ( 1 – p (j )z ) – 1
( 1 – p (j )z – 1 ) s r
6-302
residuez
6-303
residuez
References [1] Oppen h eim , A.V., a n d R.W. Sch a fer . Digital S ign al Processin g. E n glewood
Cliffs, NJ : P r en t ice H a ll, 1975. P gs. 166-170.
6-304
rlevinson
Syntax r = rlevinson(a,efinal)
[r,u] = rlevinson(a,efinal)
[r,u,k] = rlevinson(a,efinal)
[r,u,k,e] = rlevinson(a,efinal)
Description Th e r ever se Levin son -Du r bin r ecu r sion im plem en t s t h e st ep-down a lgor it h m
for solvin g t h e followin g sym m et r ic Toeplit z syst em of lin ea r equ a t ion s for r,
wh er e r = [r(1) ... r(p+1)] a n d r(i)* den ot es t h e com plex con ju ga t e of r(i).
∗ ∗
r (1 ) r (2 ) L r (p ) a (2 ) – r (2 )
r (2 ) r (1 ) L r (p – 1 )
∗ a (3 ) – r (3 )
=
M O O M M M
r (p ) L r (2 ) r (1 ) a (p + 1 ) – r (p + 1 )
–1 –2 –p x̂ ( n )
x (n ) – a ( 2 )z – a ( 3 )z – L– a ( n + 1 )z e(n )
H (z ) =
– Σ
+
A (z )
In pu t vect or a r epr esen t s t h e polyn om ia l coefficien t s of t h is pr edict ion er r or
filt er in descen din g power s of z
A (z ) = 1 + a (2 )z –1 + L+ a (n + 1 )z – p
6-305
rlevinson
∗ ∗
r (1 ) r (2 ) L r (p )
∗
R = r (2 ) r (1 ) L r (p – 1 )
M O O M
r (p ) L r (2 ) r (1 )
∗ ∗ ∗
a 1 ( 1 ) a 2 ( 2 ) La p + 1 ( p + 1 )
∗ ∗
0 a 2 (1 ) O a p + 1 (p )
U = ∗
0 0 Oa p + 1 ( p – 1 )
M O O M
∗
0 L 0 a p + 1 (1 )
6-306
rlevinson
References [1] Ka y, S.M. M od ern S pectral E stim ation : T h eory an d Application . E n glewood
Cliffs, NJ : P r en t ice H a ll, 1988.
6-307
sawtooth
Syntax x = sawtooth(t)
x = sawtooth(t,width)
6-308
sgolay
Purpose 6sgola y
Sa vit zk y-Gola y filt er design .
Syntax b = sgolay(k,f)
b = sgolay(k,f,w)
Remarks Sa vit zk y-Gola y sm oot h in g filt er s (a lso ca lled digit a l sm oot h in g polyn om ia l
filt er s or lea st squ a r es sm oot h in g filt er s) a r e t ypica lly u sed t o “sm oot h ou t ” a
n oisy sign a l wh ose fr equ en cy spa n (wit h ou t n oise) is la r ge. In t h is t ype of
a pplica t ion , Sa vit zk y-Gola y sm oot h in g filt er s per for m m u ch bet t er t h a n
st a n da r d a ver a gin g F IR filt er s, wh ich t en d t o filt er ou t a sign ifica n t por t ion of
t h e sign a l’s h igh fr equ en cy con t en t a lon g wit h t h e n oise. Alt h ou gh
Sa vit zk y-Gola y filt er s a r e m or e effect ive a t pr eser vin g t h e per t in en t h igh
fr equ en cy com pon en t s of t h e sign a l, t h ey a r e less su ccessfu l t h a n st a n da r d
a ver a gin g F IR filt er s a t r eject in g n oise.
Sa vit zk y-Gola y filt er s a r e opt im a l in t h e sen se t h a t t h ey m in im ize t h e
lea st -squ a r es er r or in fit t in g a polyn om ia l t o ea ch fr a m e of n oisy da t a .
See Also fir1 Win dow-ba sed fin it e im pu lse r espon se filt er design –
st a n da r d r espon se.
firls Lea st squ a r e lin ea r-ph a se F IR filt er design .
filter F ilt er da t a wit h a r ecu r sive (IIR) or n on r ecu r sive
(F IR) filt er.
sgolayfilt Savit zky-Gola y filt er in g.
6-309
sgolay
References [1] Or fa n idis, S.J . In trod u ction to S ign al Processin g. E n glewood Cliffs, NJ :
P r en t ice H a ll, 1996.
6-310
sgolayfilt
Syntax y = sgolayfilt(x,k,f)
y = sgolayfilt(x,k,f,w)
Remarks Sa vit zk y-Gola y sm oot h in g filt er s (a lso ca lled digit a l sm oot h in g polyn om ia l
filt er s or lea st -squ a r es sm oot h in g filt er s) a r e t ypica lly u sed t o “sm oot h ou t ” a
n oisy sign a l wh ose fr equ en cy spa n (wit h ou t n oise) is la r ge. In t h is t ype of
a pplica t ion , Sa vit zk y-Gola y sm oot h in g filt er s per for m m u ch bet t er t h a n
st a n da r d a ver a gin g F IR filt er s, wh ich t en d t o filt er ou t a sign ifica n t por t ion of
t h e sign a l’s h igh fr equ en cy con t en t a lon g wit h t h e n oise. Alt h ou gh
Sa vit zk y-Gola y filt er s a r e m or e effect ive a t pr eser vin g t h e per t in en t h igh
fr equ en cy com pon en t s of t h e sign a l, t h ey a r e less su ccessfu l t h a n st a n da r d
a ver a gin g F IR filt er s a t r eject in g n oise.
Sa vit zk y-Gola y filt er s a r e opt im a l in t h e sen se t h a t t h ey m in im ize t h e
lea st -squ a r es er r or in fit t in g a polyn om ia l t o fr a m es of n oisy da t a .
6-311
sgolayfilt
subplot(2,1,1)
plot([1:2000],mtlb(1:2000)); axis([0 2000 –4 4]);
title('mtlb'); grid;
subplot(2,1,2)
plot([1:2000],smtlb(1:2000)); axis([0 2000 –4 4]);
title('smtlb'); grid;
mtlb
4
−2
−4
0 500 1000 1500 2000
smtlb
4
−2
−4
0 500 1000 1500 2000
References [1] Or fa n idis, S.J . In trod u ction to S ign al Processin g. E n glewood Cliffs, NJ :
P r en t ice H a ll, 1996.
6-312
sinc
Purpose 6sin c
Sin c fu n ct ion .
Syntax y = sinc(x)
⎧ 1 , t =0
⎪
sin c(t ) = ⎨ sin ( πt )
⎪ -------------------, t ≠0
⎩ πt
6-313
sinc
1.5
0.5
-0.5
-1
-5 0 5 10 15
6-314
sinc
6-315
sos2ss
Purpose 6sos2ss
Con ver sion of secon d-or der sect ion s t o st a t e-spa ce.
Description sos2ss con ver t s a secon d-or der sect ion r epr esen t a t ion of a given syst em t o a n
equ iva len t st a t e-spa ce r epr esen t a t ion .
[A,B,C,D] = sos2ss(sos) con ver t s t h e syst em sos, in secon d-or der sect ion
for m , t o a sin gle-in pu t , sin gle-ou t pu t st a t e-spa ce r epr esen t a t ion :
x [n + 1 ] = A x [n ] + B u [n ]
y [n ] = C x [n ] + D u [n ]
Th e discr et e t r a n sfer fu n ct ion in secon d-or der sect ion for m is given by
L L
b 0 k + b 1 k z –1 + b 2 k z –2
H (z ) = ∏ H k (z ) = ∏ ---------------------------------------------------------
1 + a 1 k z – 1 + a 2 k z –2
-
k =1 k =1
b 01 b 11 b 21 1 a 11 a 21
b 02 b 12 b 22 1 a 12 a 22
s os =
M M M M M M
b0L b1 L b2L 1 a1L a2L
[A,B,C,D] = sos2ss(sos,g) con ver t s t h e syst em sos in secon d-or der sect ion
for m wit h ga in g:
L
H (z ) = g ∏ H k (z )
k =1
6-316
sos2ss
Example Com pu t e t h e st a t e-spa ce r epr esen t a t ion of a sim ple secon d-or der sect ion
syst em wit h a ga in of 2:
sos = [1 1 1 1 0 –1; –2 3 1 1 10 1];
[A,B,C,D] = sos2ss(sos)
A =
–10 0 10 1
1 0 0 0
0 1 0 0
0 0 1 0
B =
1
0
0
0
C =
21 2 –16 –1
D =
–2
Algorithm sos2ss fir st con ver t s fr om secon d-or der sect ion s t o t r a n sfer fu n ct ion u sin g
sos2tf, a n d t h en fr om t r a n sfer fu n ct ion t o st a t e-spa ce u sin g tf2ss.
See Also sos2tf Con ver sion of secon d-or der sect ion s t o t r a n sfer
fu n ct ion .
sos2zp Con ver sion of secon d-or der sect ion s t o zer o-pole-ga in .
ss2sos Con ver sion of st a t e-spa ce t o secon d-or der sect ion s.
tf2ss Con ver sion of t r a n sfer fu n ct ion t o st a t e-spa ce.
zp2ss Con ver sion of zer o-pole-ga in t o st a t e-spa ce.
6-317
sos2tf
Purpose 6sos2t f
Con ver sion of secon d-or der sect ion s t o t r a n sfer fu n ct ion .
Description sos2tf con ver t s a secon d-or der sect ion r epr esen t a t ion of a given syst em t o a n
equ iva len t t r a n sfer fu n ct ion r epr esen t a t ion .
b 01 b 11 b 21 1 a 11 a 21
b 02 b 12 b 22 1 a 12 a 22
s os =
M M M M M M
b0L b1 L b2L 1 a1L a2L
B (z ) b 1 + b 2 z – 1 + L+ b n + 1 z – n
H (z ) = ----------- = --------------------------------------------------------------------
-
A (z ) a 1 + a 2 z – 1 + L+ a m + 1 z – m
H (z ) = g ∏ H k (z )
k =1
6-318
sos2tf
Example Com pu t e t h e t r a n sfer fu n ct ion r epr esen t a t ion of a sim ple secon d-or der sect ion
syst em :
sos = [1 1 1 1 0 –1; –2 3 1 1 10 1];
[b,a] = sos2tf(sos)
b =
–2 1 2 4 1
a =
1 10 0 –10 –1
See Also latc2tf La t t ice filt er t o t r a n sfer fu n ct ion con ver sion .
sos2ss Con ver sion of secon d-or der sect ion s t o st a t e-spa ce.
sos2zp Con ver sion of secon d-or der sect ion s t o zer o-pole-ga in .
ss2tf Con ver sion of st a t e-spa ce t o t r a n sfer fu n ct ion .
tf2sos Con ver sion of t r a n sfer fu n ct ion t o secon d-or der
sect ion s.
zp2tf Con ver sion of zer o-pole-ga in t o t r a n sfer fu n ct ion .
6-319
sos2zp
Purpose 6sos2zp
Con ver sion of secon d-or der sect ion s t o zer o-pole-ga in .
Description sos2zp con ver t s a secon d-or der sect ion r epr esen t a t ion of a given syst em t o a n
equ iva len t zer o-pole-ga in r epr esen t a t ion .
b 01 b 11 b 21 1 a 11 a 21
b 02 b 12 b 22 1 a 12 a 22
s os =
M M M M M M
b0L b1 L b2L 1 a1L a2L
( z – z 1 ) ( z – z 2 )Lz ( – zn )
H (z ) = k -------------------------------------------------------------------
( p – p 1 ) ( p – p 2 )Lp ( – pm )
H (z ) = g ∏ H k (z )
k =1
6-320
sos2zp
Example Com pu t e t h e poles, zer os, a n d ga in of a sim ple syst em in secon d-or der sect ion
for m :
sos = [1 1 1 1 0 –1; –2 3 1 1 10 1];
[z,p,k] = sos2zp(sos)
z =
–0.5000 + 0.8660i
–0.5000 – 0.8660i
1.7808
–0.2808
p =
–1.0000
1.0000
–9.8990
–0.1010
k
–2
Algorithm sos2zp fin ds t h e poles a n d zer os of ea ch secon d-or der sect ion by r epea t edly
ca llin g tf2zp.
See Also sos2ss Con ver sion of secon d-or der sect ion s t o st a t e-spa ce.
sos2tf Con ver sion of secon d-or der sect ion s t o t r a n sfer
fu n ct ion .
ss2zp Con ver sion of st a t e-spa ce t o zer o-pole-ga in .
tf2zp Con ver sion of t r a n sfer fu n ct ion t o zer o-pole-ga in .
zp2sos Con ver sion of zer o-pole-ga in t o secon d-or der sect ion s.
6-321
sosfilt
Purpose 6sosfilt
Secon d-or der (biqu a dr a t ic) IIR filt er in g.
Syntax y = sosfilt(sos,x)
Description y = sosfilt(sos,x) a pplies t h e secon d-or der sect ion filt er sos t o vect or x.
Th e ou t pu t , y, is t h e sa m e len gt h a s x.
sos r epr esen t s t h e secon d-or der sect ion filt er H (z)
L L
b 0 k + b 1 k z –1 + b 2 k z –2
H (z ) = ∏ H k (z ) = ∏ ---------------------------------------------------------
1 + a 1 k z – 1 + a 2 k z –2
-
k =1 k =1
b 01 b 11 b 21 1 a 11 a 21
b 02 b 12 b 22 1 a 12 a 22
s os =
M M M M M M
b0L b1 L b2L 1 a1L a2L
See Also filter F ilt er da t a wit h a r ecu r sive (IIR) or n on r ecu r sive
(F IR) filt er.
medfilt1 On e-dim en sion a l m edia n filt er in g.
sgolayfilt Savit zky-Gola y filt er in g.
References [1] Or fa n idis, S.J . In trod u ction to S ign al Processin g. E n glewood Cliffs, NJ :
P r en t ice H a ll, 1996.
6-322
specgram
Purpose 6specgr a m
Tim e-depen den t fr equ en cy a n a lysis (spect r ogr a m ).
Syntax B = specgram(a)
B = specgram(a,nfft)
[B,f] = specgram(a,nfft,Fs)
[B,f,t] = specgram(a,nfft,Fs)
B = specgram(a,nfft,Fs,window)
B = specgram(a,nfft,Fs,window,noverlap)
specgram(a)
B = specgram(a,f,Fs,window,noverlap)
Description specgram com pu t es t h e win dowed discr et e-t im e F ou r ier t r a n sfor m of a sign a l
u sin g a slidin g win dow. Th e spect r ogr a m is t h e m a gn it u de of t h is fu n ct ion .
6-323
specgram
6-324
specgram
6-325
specgram
3500
3000
2500
Frequency
2000
1500
1000
500
0
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45
Time
Diagnostics An a ppr opr ia t e dia gn ost ic m essa ge is displa yed wh en in cor r ect a r gu m en t s a r e
u sed:
Requires window's length to be no greater than the FFT length.
Requires NOVERLAP to be strictly less than the window length.
Requires positive integer values for NFFT and NOVERLAP.
Requires vector input.
6-326
specgram
References [1] Oppen h eim , A.V., a n d R.W. Sch a fer . Discrete-T im e S ign al Processin g.
E n glewood Cliffs, NJ : P r en t ice H a ll, 1989. P gs. 713-718.
[2] Ra bin er , L.R., a n d R.W. Sch a fer . Digital Processin g of S peech S ign als.
E n glewood Cliffs, NJ : P r en t ice H a ll, 1978.
6-327
sptool
Syntax sptool
6-328
sptool
6-329
sptool
6-330
sptool
6-331
square
Purpose 6squ a re
Squ a r e wa ve gen er a t or .
Syntax x = square(t)
x = square(t,duty)
6-332
ss2sos
Purpose 6ss2sos
Con ver sion of st a t e-spa ce t o secon d-or der sect ion s.
Description ss2sos con ver t s a st a t e-spa ce r epr esen t a t ion of a given syst em t o a n
equ iva len t secon d-or der sect ion r epr esen t a t ion .
[sos,g] = ss2sos(A,B,C,D) fin ds a m a t r ix sos in secon d-or der sect ion for m
wit h ga in g t h a t is equ iva len t t o t h e st a t e-spa ce syst em r epr esen t ed by in pu t
a r gu m en t s A, B, C a n d D. Th e in pu t syst em m u st be sin gle ou t pu t a n d r ea l. sos
is a n L -by-6 m a t r ix
b 01 b 11 b 21 1 a 11 a 21
b 02 b 12 b 22 1 a 12 a 22
s os =
M M M M M M
b0L b1L b2L 1 a1L a2L
[sos,g] = ss2sos(A,B,C,D,'order') a n d
6-333
ss2sos
Usin g in fin it y-n or m sca lin g in con ju n ct ion wit h up-or der in g m in im izes t h e
pr oba bilit y of over flow in t h e r ea liza t ion . Usin g 2-n or m sca lin g in con ju n ct ion
wit h down-or der in g m in im izes t h e pea k r ou n d-off n oise.
H (z ) = ∏ H k (z )
k =1
Example F in d a secon d-or der sect ion for m of a Bu t t er wor t h lowpa ss filt er :
[A,B,C,D] = butter(5,0.2);
sos = ss2sos(A,B,C,D)
sos =
0.0013 0.0013 0 1.0000 –0.5095 0
1.0000 2.0008 1.0008 1.0000 –1.0966 0.3554
1.0000 1.9979 0.9979 1.0000 –1.3693 0.6926
Algorithm ss2sos u ses a fou r -st ep a lgor it h m t o det er m in e t h e secon d-or der sect ion
r epr esen t a t ion for a n in pu t st a t e-spa ce syst em :
6-334
ss2sos
6-335
ss2sos
References [1] J a ckson , L.B. Digital Filters an d S ign al Processin g. 3r d ed. Bost on : Klu wer
Aca dem ic P u blish er s, 1996. Ch a pt er 11.
[2] Mit r a , S.K. Digital S ign al Processin g: A Com pu ter-B ased Approach . New
Yor k : McGr a w-H ill, 1998. Ch a pt er 9.
[3] Va idya n a t h a n , P .P . “Robu st Digit a l F ilt er St r u ct u r es.” H an d book for
Digital S ign al Processin g. S.K. Mit r a a n d J .F . Ka iser , ed. Ch a pt er 7. New Yor k:
J oh n Wiley & Son s, 1993.
6-336
ss2tf
Purpose 6ss2t f
Con ver sion of st a t e-spa ce t o t r a n sfer fu n ct ion .
Description ss2tf con ver t s a st a t e-spa ce r epr esen t a t ion of a given syst em t o a n equ iva len t
t r a n sfer fu n ct ion r epr esen t a t ion .
B (s )
H (s ) = ----------- = C ( s I – A ) – 1 B + D
A (s )
of t h e syst em
·
x = Ax + Bu
y = Cx + Du
fr om t h e iu-t h in pu t . Vect or a con t a in s t h e coefficien t s of t h e den om in a t or in
descen din g power s of s. Th e n u m er a t or coefficien t s a r e r et u r n ed in a r r a y b wit h
a s m a n y r ows a s t h er e a r e ou t pu t s y. ss2tf a lso wor ks wit h syst em s in discr et e
t im e, in wh ich ca se it r et u r n s t h e z-t r a n sfor m r epr esen t a t ion .
Th e ss2tf fu n ct ion is pa r t of t h e st a n da r d MATLAB la n gu a ge.
Algorithm Th e ss2tf fu n ct ion u ses poly t o fin d t h e ch a r a ct er ist ic polyn om ia l det (sI-A)
a n d t h e equ a lit y
det (s I – A + B C ) – det (s I – A )
H (s ) = C ( s I – A ) – 1 B = ------------------------------------------------------------------------------
det (s I – A )
See Also latc2tf La t t ice filt er t o t r a n sfer fu n ct ion con ver sion .
sos2tf Con ver sion of secon d-or der sect ion s t o t r a n sfer
fu n ct ion .
ss2sos Con ver sion of st a t e-spa ce t o secon d-or der sect ion s.
ss2zp Con ver sion of st a t e-spa ce t o zer o-pole-ga in .
tf2ss Con ver sion of t r a n sfer fu n ct ion t o st a t e-spa ce.
zp2tf Con ver sion of zer o-pole-ga in t o t r a n sfer fu n ct ion .
6-337
ss2zp
Purpose 6ss2zp
Con ver sion of st a t e-spa ce t o zer o-pole-ga in .
Description ss2zp con ver t s a st a t e-spa ce r epr esen t a t ion of a given syst em t o a n equ iva len t
zer o-pole-ga in r epr esen t a t ion . Th e zer os, poles, a n d ga in s of st a t e-spa ce
syst em s r epr esen t t h e t r a n sfer fu n ct ion in fa ct or ed for m .
Z (s ) ( s – z 1 ) ( s – z 2 )Ls ( – zn )
H (s ) = ---------- = k ---------------------------------------------------------------
P (s ) ( s – p 1 ) ( s – p 2 )Ls ( – pn )
of t h e syst em
·
x = Ax + Bu
y = Cx + Du
fr om t h e iu-t h in pu t . Ret u r n ed colu m n vect or p con t a in s t h e pole loca t ion s of
t h e den om in a t or coefficien t s of t h e t r a n sfer fu n ct ion . Ma t r ix z con t a in s t h e
n u m er a t or zer os in it s colu m n s, wit h a s m a n y colu m n s a s t h er e a r e ou t pu t s y.
Colu m n vect or k con t a in s t h e ga in s for ea ch n u m er a t or t r a n sfer fu n ct ion .
ss2zp a lso wor ks wit h syst em s in discr et e t im e, in wh ich ca se it r et u r n s t h e
z-t r a n sfor m r epr esen t a t ion . Th e in pu t st a t e-spa ce syst em m u st be r ea l.
Th e ss2zp fu n ct ion is pa r t of t h e st a n da r d MATLAB la n gu a ge.
6-338
ss2zp
z =
–1.5000
p =
–0.2000 + 0.9798i
–0.2000 – 0.9798i
k =
2
[A,B,C,D] = tf2ss(b,a);
[z,p,k] = ss2zp(A,B,C,D,1)
z =
–1.5000
p =
–0.2000 + 0.9798i
–0.2000 – 0.9798i
k =
2
In m a n y sit u a t ion s t h is a lgor it h m pr odu ces spu r iou s la r ge, bu t fin it e, zer os.
ss2zp in t er pr et s t h ese la r ge zer os a s in fin it e.
6-339
ss2zp
See Also pzmap Pole-zer o m a p of LTI syst em (Con trol S ystem T oolbox
User’s Gu id e).
sos2zp Con ver sion of secon d-or der sect ion s t o zer o-pole-ga in .
ss2sos Con ver sion of st a t e-spa ce t o secon d-or der sect ion s.
ss2tf Con ver sion of st a t e-spa ce t o t r a n sfer fu n ct ion .
tf2zp Con ver sion of t r a n sfer fu n ct ion t o zer o-pole-ga in .
zp2ss Con ver sion of zer o-pole-ga in t o st a t e-spa ce.
References [1] La u b, A.J ., a n d B.C. Moor e. “Ca lcu la t ion of Tr a n sm ission Zer os Usin g QZ
Tech n iqu es.” A u tom atica 14 (1978). P g. 557.
6-340
stmcb
Purpose 6st m cb
Lin ea r m odel u sin g St eiglit z-McBr ide it er a t ion .
Description St eiglit z-McBr ide it er a t ion is a n a lgor it h m for fin din g a n IIR filt er wit h a
pr escr ibed t im e dom a in im pu lse r espon se. It h a s a pplica t ion s in bot h filt er
design a n d syst em iden t ifica t ion (pa r a m et r ic m odelin g).
[b,a] = stmcb(x,nb,na,niter) a n d
[b,a] = stmcb(x,nb,na,niter,ai) a n d
B (z ) b (1 ) + b (2 )z – 1 + L+ b (n b + 1 )z – n b
H (z ) = ----------- = ----------------------------------------------------------------------------------------
-
A (z ) a (1 ) + a (2 )z – 1 + L+ a (n a + 1 )z – n a
6-341
stmcb
0
Magnitude (dB)
−100
−200
−300
0 0.2 0.4 0.6 0.8 1
Normalized Angular Frequency (×π rads/sample)
0
Phase (degrees)
−200
−400
−600
0 0.2 0.4 0.6 0.8 1
Normalized Angular Frequency (×π rads/sample)
[bb,aa] = stmcb(h,4,4);
freqz(bb,aa,128)
20
Magnitude (dB)
−20
−40
−60
0 0.2 0.4 0.6 0.8 1
Normalized Angular Frequency (×π rads/sample)
0
Phase (degrees)
−200
−400
−600
−800
0 0.2 0.4 0.6 0.8 1
Normalized Angular Frequency (×π rads/sample)
6-342
stmcb
References [1] St eiglit z, K., a n d L.E . McBr ide. “A Tech n iqu e for t h e Iden t ifica t ion of Lin ea r
Syst em s.” IE E E T ran s. Au tom atic Con trol. Vol. AC-10 (1965). P gs. 461-464.
[2] Lju n g, L. S ystem Id en tification : T h eory for th e User. E n glewood Cliffs, NJ :
P r en t ice H a ll, 1987. P g. 297.
6-343
strips
Syntax strips(x)
strips(x,n)
strips(x,sd,Fs)
strips(x,sd,Fs,scale)
6-344
strips
Example P lot t wo secon ds of a fr equ en cy m odu la t ed sin u soid in 0.25 secon d st r ips:
Fs = 1000; % sampling frequency
t = 0:1/Fs:2; % time vector
x = vco(sin(2*pi*t),[10 490],Fs); % FM waveform
strips(x,0.25,Fs)
0.25
0.5
0.75
1.25
1.5
1.75
6-345
tf2latc
Purpose 6t f2la t c
Con ver sion of t r a n sfer fu n ct ion t o la t t ice filt er .
See Also latc2tf La t t ice filt er t o t r a n sfer fu n ct ion con ver sion .
latcfilt La t t ice a n d la t t ice-la dder filt er im plem en t a t ion .
tf2sos Con ver sion of t r a n sfer fu n ct ion t o secon d-or der
sect ion s.
tf2ss Con ver sion of t r a n sfer fu n ct ion t o st a t e-spa ce.
tf2zp Con ver sion of t r a n sfer fu n ct ion t o zer o-pole-ga in .
6-346
tf2sos
Purpose 6tf2sos
Con ver sion of t r a n sfer fu n ct ion t o secon d-or der sect ion s.
Description tf2sos con ver t s a t r a n sfer fu n ct ion r epr esen t a t ion of a given syst em t o a n
equ iva len t secon d-or der sect ion r epr esen t a t ion .
[sos,g] = tf2sos(b,a) fin ds a m a t r ix sos in secon d-or der sect ion for m wit h
ga in g t h a t is equ iva len t t o t h e syst em r epr esen t ed by t r a n sfer fu n ct ion
coefficien t vect or s a a n d b.
B (z ) b 1 + b 2 z – 1 + L+ b n b + 1 z – n b
H (z ) = ----------- = ------------------------------------------------------------------------
-
A (z ) a 1 + a 2 z – 1 + L+ a n a + 1 z – n a
sos is a n L -by-6 m a t r ix
b 01 b 11 b 21 1 a 11 a 21
b 02 b 12 b 22 1 a 12 a 22
s os =
M M M M M M
b0L b1L b2L 1 a1L a2L
6-347
tf2sos
Usin g in fin it y-n or m sca lin g in con ju n ct ion wit h up-or der in g m in im izes t h e
pr oba bilit y of over flow in t h e r ea liza t ion . Usin g 2-n or m sca lin g in con ju n ct ion
wit h down-or der in g m in im izes t h e pea k r ou n d-off n oise.
H (z ) = ∏ H k (z )
k =1
6-348
tf2sos
References [1] J a ckson , L.B. Digital Filters an d S ign al Processin g. 3r d ed. Bost on : Klu wer
Aca dem ic P u blish er s, 1996. Ch a pt er 11.
[2] Mit r a , S.K. Digital S ign al Processin g: A Com pu ter-B ased Approach . New
Yor k : McGr a w-H ill, 1998. Ch a pt er 9.
[3] Va idya n a t h a n , P .P . “Robu st Digit a l F ilt er St r u ct u r es.” H an d book for
Digital S ign al Processin g. S.K. Mit r a a n d J .F . Ka iser , ed. Ch a pt er 7. New Yor k :
J oh n Wiley & Son s, 1993.
6-349
tf2ss
Purpose 6t f2ss
Con ver sion of t r a n sfer fu n ct ion t o st a t e-spa ce.
Description tf2ss con ver t s a t r a n sfer fu n ct ion r epr esen t a t ion of a given syst em t o a n
equ iva len t st a t e-spa ce r epr esen t a t ion .
·
x = Ax + Bu
y = Cx + Du
given a syst em in t r a n sfer fu n ct ion for m :
B (s )
H (s ) = ----------- = C ( s I – A ) – 1 B + D
A (s )
fr om a sin gle in pu t . In pu t vect or a con t a in s t h e den om in a t or coefficien t s in
descen din g power s of s. Ma t r ix b con t a in s t h e n u m er a t or coefficien t s wit h a s
m a n y r ows a s t h er e a r e ou t pu t s y. tf2ss r et u r n s t h e A, B, C, a n d D m a t r ices in
con t r oller ca n on ica l for m .
tf2ss a lso wor ks for discr et e syst em s, bu t you m u st pa d t h e n u m er a t or wit h
t r a ilin g zer os t o m a ke it t h e sa m e len gt h a s t h e den om in a t or .
Th e tf2ss fu n ct ion is pa r t of t h e st a n da r d MATLAB la n gu a ge.
2s + 3
s2
+ 2s + 1
H (s ) = --------------------------------
2
-
s + 0.4 s + 1
6-350
tf2ss
A =
–0.4000 –1.0000
1.0000 0
B =
1
0
C =
2.0000 3.0000
1.6000 0
D =
0
1
See Also sos2ss Con ver sion of secon d-or der sect ion s t o st a t e-spa ce.
ss2tf Con ver sion of st a t e-spa ce t o t r a n sfer fu n ct ion .
tf2sos Con ver sion of t r a n sfer fu n ct ion t o secon d-or der
sect ion s.
tf2zp Con ver sion of t r a n sfer fu n ct ion t o zer o-pole-ga in .
zp2ss Con ver sion of zer o-pole-ga in t o st a t e-spa ce.
6-351
tf2zp
Purpose 6t f2zp
Con ver sion of t r a n sfer fu n ct ion t o zer o-pole-ga in .
Z (s ) ( s – Z 1 ) ( s – Z 2 )Ls ( – Zm )
H (s ) = ---------- = k ------------------------------------------------------------------
P (s ) ( s – p 1 ) ( s – p 2 )Ls ( – pn )
B (s ) b 1 s ( n b – 1 ) + L+ b ( n b – 1 ) s + b ( n b )
----------- = --------------------------------------------------------------------------------------
-
A (s ) a 1 s ( n a – 1 ) + L+ a ( n a – 1 ) s + a ( n a )
6-352
tf2zp
2s + 3
H (s ) = --------------------------------
-
s 2 + 0.4 s + 1
b = [2 3];
a = [1 0.4 1];
[z,p,k] = tf2zp(b,a)
z =
–1.5000
p =
–0.2000 + 0.9798i
–0.2000 – 0.9798i
k =
Algorithm Th e syst em is con ver t ed t o st a t e-spa ce u sin g tf2ss a n d t h en t o zer os, poles,
a n d ga in s u sin g ss2zp.
See Also sos2zp Con ver sion of secon d-or der sect ion s t o zer o-pole-ga in .
ss2zp Con ver sion of st a t e-spa ce t o zer o-pole-ga in .
tf2sos Con ver sion of t r a n sfer fu n ct ion t o secon d-or der
sect ion s.
tf2ss Con ver sion of t r a n sfer fu n ct ion t o st a t e-spa ce.
zp2tf Con ver sion of zer o-pole-ga in t o t r a n sfer fu n ct ion .
6-353
tfe
Purpose 6t fe
Tr a n sfer fu n ct ion est im a t e fr om in pu t a n d ou t pu t .
Description Txy = tfe(x,y) fin ds a t r a n sfer fu n ct ion est im a t e Txy given in pu t sign a l
vect or x a n d ou t pu t sign a l vect or y. Th e tran sfer fu n ction is t h e qu ot ien t of t h e
cr oss spect r u m of x a n d y a n d t h e power spect r u m of x:
P x y (f )
T x y (f ) = ---------------
P x x (f )
6-354
tfe
• linear, t o r em ove t h e best st r a igh t -lin e fit fr om t h e pr ewin dowed sect ion s of
x and y
• mean, t o r em ove t h e m ea n fr om t h e pr ewin dowed sect ion s of x a n d y
• none, for n o det r en din g (defa u lt )
6-355
tfe
Example Com pu t e a n d plot t h e t r a n sfer fu n ct ion est im a t e bet ween t wo color ed n oise
sequ en ces x a n d y:
h = fir1(30,0.2,boxcar(31));
x = randn(16384,1);
y = filter(h,1,x);
tfe(x,y,1024,[],[],512)
title('Transfer Function Estimate')
Transfer Function Estimate
5
-5
Tranfer Function Estimate (dB)
-10
-15
-20
-25
-30
-35
-40
-45
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Frequency
6-356
tfe
Diagnostics An a ppr opr ia t e dia gn ost ic m essa ge is displa yed wh en in cor r ect a r gu m en t s a r e
u sed:
Requires window's length to be no greater than the FFT length.
Requires NOVERLAP to be strictly less than the window length.
Requires positive integer values for NFFT and NOVERLAP.
Requires vector (either row or column) input.
Requires inputs X and Y to have the same length.
6-357
triang
Purpose 6t ria n g
Tr ia n gu la r win dow.
Syntax w = triang(n)
2k
⎧ ------------ n +1
-, 1 ≤ k ≤ -------------
⎪ n + 1 2
w [ k ] = ⎨
⎪ 2------------------------------
(n – k + 1 )
-,
n +1
------------- ≤ k ≤ n
⎩ n +1 2
F or n even :
⎧ 2---------------
k –1
-,
n
1 ≤ k ≤ ---
⎪ n 2
w [ k ] = ⎨
⎪ 2------------------------------
(n – k + 1 )
-,
n
--- + 1 ≤ k ≤ n
⎩ n 2
References [1] Oppen h eim , A.V., a n d R.W. Sch a fer , Discrete-T im e S ign al Processin g.
E n glewood Cliffs, NJ : P r en t ice-H a ll, 1989.
6-358
tripuls
Syntax y = tripuls(T)
y = tripuls(T,w)
y = tripuls(T,w,s)
6-359
unwrap
Purpose 6u n wr a p
Un wr a p ph a se a n gles.
Syntax p = unwrap(p)
Limitations unwrap t r ies t o det ect br a n ch cu t cr ossin gs, bu t it ca n be fooled by spa r se,
r a pidly ch a n gin g ph a se va lu es.
6-360
upfirdn
Purpose 6u pfird n
Upsa m ple, a pply a n F IR filt er , a n d down sa m ple.
6-361
upfirdn
NOTE Sin ce upfirdn per for m s con volu t ion a n d r a t e ch a n gin g, t h e yout
sign a ls h ave a differ en t len gt h t h a n xin. Th e len gt h of y[n ] is a ppr oxim a t ely
p/q t im es t h e len gt h of x[n ].
6-362
upfirdn
6-363
upfirdn
References [1] Cr och ier e, R.E ., a n d L.R. Ra bin er . M u lti-R ate S ign al Processin g.
E n glewood Cliffs, NJ : P r en t ice H a ll, 1983. P gs. 88-91.
[2] Cr och ier e, R.E . “A Gen er a l P r ogr a m t o P er for m Sa m plin g Ra t e Con ver sion
of Da t a by Ra t ion a l Ra t ios.” In Program s for Digital S ign al Processin g. IE E E
P r ess. New Yor k: J oh n Wiley & Son s, 1979. P gs. 8.2-1 t o 8.2-7.
6-364
vco
Purpose 6vco
Volt a ge con t r olled oscilla t or .
Syntax y = vco(x,Fc,Fs)
y = vco(x,[Fmin Fmax],Fs)
6-365
vco
5000
4500
4000
3500
3000
Frequency
2500
2000
1500
1000
500
0
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8
Time
See Also demod Dem odu la t ion for com m u n ica t ion s sim u la t ion .
modulate Modu la t ion for com m u n ica t ion s sim u la t ion .
6-366
xcorr
Purpose 6xcor r
Cr oss-cor r ela t ion fu n ct ion est im a t e.
Syntax c = xcorr(x,y)
c = xcorr(x)
c = xcorr(x,y,'option')
c = xcorr(x,'option')
c = xcorr(x,y,maxlags)
c = xcorr(x,maxlags)
c = xcorr(x,y,maxlags,'option')
c = xcorr(x,maxlags,'option')
[c,lags] = xcorr(...)
γ x y (m ) = E {x n y * n + m }
⎧ N – m – 1
⎪ x n y n* + m
⎪ ∑ m ≥0
c x y (m ) = ⎨
⎪ n = 0
⎪ *
⎩ c y x (– m ) m <0
6-367
xcorr
See r efer en ce [1] for m or e in for m a t ion on t h e pr oper t ies of bia sed a n d u n bia sed
cor r ela t ion est im a t es.
6-368
xcorr
c1 =
lags =
–2 –1 0 1 2
c2 = conj(fliplr(xcorr(y,x)));
c2 = mat2str(c2,2)
c2 =
F or t h e ca se wh er e in pu t a r gu m en t x is a m a t r ix, t h e ou t pu t colu m n s a r e
a r r a n ged so t h a t ext r a ct in g a r ow a n d r ea r r a n gin g it in t o a squ a r e a r r a y
6-369
xcorr
c0 =
1.7500 0.3079
0.3079 0.1293
Algorithm F or m or e in for m a t ion on est im a t in g cova r ia n ce a n d cor r ela t ion fu n ct ion s, see
[1] a n d [2].
6-370
xcorr
References [1] Ben da t , J .S., a n d A.G. P ier sol. R an d om Data: An alysis an d M easu rem en t
Proced u res. New Yor k: J oh n Wiley & Son s, 1971. P g. 332.
[2] Oppen h eim , A.V., a n d R.W. Sch a fer . Digital S ign al Processin g. E n glewood
Cliffs, NJ : P r en t ice H a ll, 1975. P gs. 63-67, 746-747, 839-842.
6-371
xcorr2
Purpose 6xcor r 2
Two-dim en sion a l cr oss-cor r ela t ion .
Syntax C = xcorr2(A)
C = xcorr2(A,B)
6-372
xcov
Purpose 6xcov
Cr oss-cova r ia n ce fu n ct ion est im a t e (equ a l t o m ea n -r em oved cr oss-cor r ela t ion ).
Syntax v = xcov(x,y)
v = xcov(x)
v = xcov(x,'option')
[c,lags] = xcov(x,y,maxlags)
[c,lags] = xcov(x,maxlags)
[c,lags] = xcov(x,y,maxlags,'option')
φ x y (m ) = E { ( x n – m x ) ( y n + m – m y ) * }
⎧ N – m – 1 ⎛ N –1
⎞ ⎛
–
⎞
⎪ 1
⎜ x (n ) – ---- ⎟ ⎜ * 1
⎪ ∑ ∑ x i⎟ ⎜ y n + m – ---- ∑ y i*⎟ m ≥0
⎜ N N ⎟
c x y (m ) = ⎨ ⎝ i = 0 ⎠ ⎝ ⎠
⎪ n = 0 =
⎪
⎩ c y*x (– m ) m <0
6-373
xcov
See [1] for m or e in for m a t ion on t h e pr oper t ies of bia sed a n d u n bia sed
cor r ela t ion a n d cova r ia n ce est im a t es.
6-374
xcov
References [1] Ben da t , J .S., a n d A.G. P ier sol. R an d om Data: An alysis an d M easu rem en t
Proced u res. New Yor k: J oh n Wiley & Son s, 1971. P g. 332.
[2] Oppen h eim , A.V., a n d R.W. Sch a fer . Digital S ign al Processin g. E n glewood
Cliffs, NJ : P r en t ice H a ll, 1975. P gs. 63-67, 746-747, 839-842.
6-375
yulewalk
Description yulewalk design s r ecu r sive IIR digit a l filt er s u sin g a lea st -squ a r es fit t o a
specified fr equ en cy r espon se.
B (z ) b (1 ) + b (2 )z – 1 + L+ b (n + 1 )z – n
----------- = ---------------------------------------------------------------------------------
-
A (z ) a (1 ) + a (2 )z –1 + L+ a (n + 1 )z – n
Wh en specifyin g t h e fr equ en cy r espon se, a void excessively sh a r p t r a n sit ion s
fr om pa ssba n d t o st opba n d. You m a y n eed t o exper im en t wit h t h e slope of t h e
t r a n sit ion r egion t o get t h e best filt er design .
Example Design a n 8t h -or der lowpa ss filt er a n d over plot t h e desir ed fr equ en cy r espon se
wit h t h e a ct u a l fr equ en cy r espon se:
f = [0 0.6 0.6 1];
m = [1 1 0 0];
6-376
yulewalk
[b,a] = yulewalk(8,f,m);
[h,w] = freqz(b,a,128);
plot(f,m,w/pi,abs(h),'--')
1.2
0.8
0.6
0.4
0.2
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
6-377
yulewalk
References [1] F r iedla n der , B., a n d B. P or a t . “Th e Modified Yu le-Wa lker Met h od of ARMA
Spect r a l E st im a t ion .” IE E E T ran saction s on Aerospace E lectron ic S ystem s.
AE S-20, No. 2 (Ma r ch 1984). P gs. 158-173.
6-378
zp2sos
Purpose 6zp2sos
Con ver sion of zer o-pole-ga in t o secon d-or der sect ion s.
Description zp2sos con ver t s a zer o-pole-ga in r epr esen t a t ion of a given syst em t o a n
equ iva len t secon d-or der sect ion r epr esen t a t ion .
[sos,g] = zp2sos(z,p,k) fin ds a m a t r ix sos in secon d-or der sect ion for m
wit h ga in g equ iva len t t o t h e zer o-pole-ga in syst em r epr esen t ed by in pu t
a r gu m en t s z, p, a n d k. Vect or s z a n d p con t a in t h e zer os a n d poles of t h e syst em
H (z), n ot n ecessa r ily in a n y or der :
( z – z 1 ) ( z – z 2 )Lz ( – zn )
H (z ) = k -----------------------------------------------------------------
( z – p 1 ) ( z – p 2 )Lz ( – pm )
b 01 b 11 b 21 1 a 11 a 21
b 02 b 12 b 22 1 a 12 a 22
s os =
M M M M M M
b0L b1L b2L 1 a1L a2L
6-379
zp2sos
Usin g in fin it y-n or m sca lin g in con ju n ct ion wit h up-or der in g m in im izes t h e
pr oba bilit y of over flow in t h e r ea liza t ion . Usin g 2-n or m sca lin g in con ju n ct ion
wit h down-or der in g m in im izes t h e pea k r ou n d-off n oise.
H (z ) = ∏ H k (z )
k =1
Example F in d a secon d-or der sect ion for m of a Bu t t er wor t h lowpa ss filt er :
[z,p,k] = butter(5,0.2);
sos = zp2sos(z,p,k);
Algorithm zp2sos u ses a fou r -st ep a lgor it h m t o det er m in e t h e secon d-or der sect ion
r epr esen t a t ion for a n in pu t zer o-pole-ga in syst em :
6-380
zp2sos
6-381
zp2sos
References [1] J a ckson , L.B. Digital Filters an d S ign al Processin g. 3r d ed. Bost on : Klu wer
Aca dem ic P u blish er s, 1996. Ch a pt er 11.
[2] Mit r a , S.K. Digital S ign al Processin g: A Com pu ter-B ased Approach . New
Yor k : McGr a w-H ill, 1998. Ch a pt er 9.
[3] Va idya n a t h a n , P .P . “Robu st Digit a l F ilt er St r u ct u r es.” H an d book for
Digital S ign al Processin g. S.K. Mit r a a n d J .F . Ka iser , ed. Ch a pt er 7. New Yor k:
J oh n Wiley & Son s, 1993.
6-382
zp2ss
Purpose 6zp2ss
Con ver sion of zer o-pole-ga in t o st a t e-spa ce.
Description zp2ss con ver t s a zer o-pole-ga in r epr esen t a t ion of a given syst em t o a n
equ iva len t st a t e-spa ce r epr esen t a t ion .
Z (s ) ( s – z 1 ) ( s – z 2 )Ls ( – zn )
H (s ) = ---------- = k ---------------------------------------------------------------
P (s ) ( s – p 1 ) ( s – p 2 )Ls ( – pn )
Algorithm zp2ss, for sin gle-in pu t syst em s, gr ou ps com plex pa ir s t oget h er in t o t wo-by-t wo
blocks down t h e dia gon a l of t h e A m a t r ix. Th is r equ ir es t h e zer os a n d poles t o
be r ea l or com plex con ju ga t e pa ir s.
See Also sos2ss Con ver sion of secon d-or der sect ion s t o st a t e-spa ce.
ss2zp Con ver sion of st a t e-spa ce t o zer o-pole-ga in .
tf2ss Con ver sion of t r a n sfer fu n ct ion t o st a t e-spa ce.
zp2sos Con ver sion of zer o-pole-ga in t o secon d-or der sect ion s.
zp2tf Con ver sion of zer o-pole-ga in t o t r a n sfer fu n ct ion .
6-383
zp2tf
Purpose 6zp2t f
Con ver sion of zer o-pole-ga in t o t r a n sfer fu n ct ion .
B (s ) b 1 s ( n b – 1 ) + L+ b ( n b – 1 ) s + b n b
----------- = ----------------------------------------------------------------------------------
-
A (s ) a 1 s ( n a – 1 ) + L+ a ( n a – 1 ) s + a n a
Z (s ) ( s – z 1 ) ( s – z 2 )Ls ( – zm )
H (s ) = ---------- = k ---------------------------------------------------------------
P (s ) ( s – p 1 ) ( s – p 2 )Ls ( – pn )
Algorithm Th e syst em is con ver t ed t o t r a n sfer fu n ct ion for m u sin g poly wit h p a n d t h e
colu m n s of Z.
See Also sos2tf Con ver sion of secon d-or der sect ion s t o t r a n sfer
fu n ct ion .
ss2tf Con ver sion of st a t e-spa ce t o t r a n sfer fu n ct ion .
tf2zp Con ver sion of t r a n sfer fu n ct ion t o zer o-pole-ga in .
zp2sos Con ver sion of zer o-pole-ga in t o secon d-or der sect ion s.
zp2ss Con ver sion of zer o-pole-ga in t o st a t e-spa ce.
6-384
zplane
Purpose 6zpla n e
Zer o-pole plot .
Syntax zplane(z,p)
zplane(b,a)
[hz,hp,ht] = zplane(z,p)
or
set(gca,'ylim',[ymin ymax])
or
set(gca,'xlim',[xmin xmax])
6-385
zplane
Examples P lot t h e poles a n d zer os of a 5t h -or der Bu t t er wor t h lowpa ss digit a l filt er wit h
cu t off fr equ en cy of 0.2:
[z,p,k] = butter(5,0.2);
zplane(z,p);
title('5th-Order Butterworth Lowpass Digital Filter');
0.8
0.6
0.4
Imaginary Part
0.2
5
0
−0.2
−0.4
−0.6
−0.8
−1
−1 −0.5 0 0.5 1
Real Part
6-386
Index
A
abs 6-2, 6-12 design 2-7
ac2poly 6-3, 6-13 Bessel 2-11, 6-22
ac2rc 6-3, 6-14 Bu t t er wor t h 6-43
a lgor it h m , filt er in g in SP Tool 5-18 Ch ebysh ev t ype I 6-65
a lia sed sin c fu n ct ion . S ee Dir ich let fu n ct ion Ch ebysh ev t ype II 6-71
a lia sin g ellipt ic 6-125, 6-126
a n d im pu lse in va r ia n ce 2-42 in ver se 6-203
pr even t in g du r in g r esa m plin g 4-21 fr equ en cy r espon se 1-26, 6-173
r edu cin g wit h a n a lyt ic sign a l 4-38 or der est im a t ion
a ll-pole filt er . S ee IIR filt er Bu t t er wor t h 6-49
a ll-zer o filt er . S ee F IR filt er Ch ebysh ev t ype I 6-56
am 4-29 Ch ebysh ev t ype II 6-61
AM. S ee a m plit u de m odu la t ion ellipt ic 6-133
amdsb–sc 4-29, 6-236 r epr esen t a t ion a l m odels 1-40
amdsb–tc 4-29, 6-236 a n a log fr equ en cy xvii
a m plit u de dem odu la t ion a n a log pr ot ot ype 2-38
dou ble side-ba n d, su ppr essed ca r r ier 6-114 Bessel filt er 2-11, 6-21
dou ble side-ba n d, t r a n sm it t ed ca r r ier 6-114 Bu t t er wor t h filt er 2-8, 6-42
sin gle side-ba n d 6-114 Ch ebysh ev t ype I filt er 2-9, 6-54
a m plit u de m odu la t ion 4-29 Ch ebysh ev t ype II filt er 2-10, 6-59
dou ble side-ba n d, su ppr essed ca r r ier 6-236 con ver sion t o ba n dpa ss 6-220
dou ble side-ba n d, t r a n sm it t ed ca r r ier 6-236 con ver sion t o ba n dst op 6-223
sin gle side-ba n d 6-236 con ver sion t o h igh pa ss 6-225
amssb 4-30, 6-236 con ver sion t o lowpa ss 6-227
a n a log filt er ellipt ic filt er 6-131
Bessel 6-22 fr equ en cy r espon se 2-12
Bu t t er wor t h 6-44 plot t in g 2-12
Ch ebysh ev t ype I 6-66 a n a log pr ot ot ype design
Ch ebysh ev t ype II 6-71 Bessel 2-38
con ver t in g t o digit a l 2-41, 6-194 bilin ea r t r a n sfor m a t ion 2-43
Bu t t er wor t h 2-38
Ch ebysh ev 2-38
ellipt ic 2-38
filt er discr et iza t ion 2-41
fr equ en cy t r a n sfor m a t ion 2-38
im pu lse in va r ia n ce 2-42
I-1
Index
I-2
Index
I-3
Index
I-4
Index
I-5
Index
I-6
Index
Defa u lt Session ch eck box, in P r efer en ces dia log iden t ifica t ion fr om fr equ en cy da t a 6-207
box 5-28 IIR 2-4
Defa u lt SP Tool session file 5-20, 5-28 com pa r ed t o F IR 2-4
defa u lt va lu es, u sin g em pt y m a t r ix 3-11 im plem en t a t ion 1-14, 6-142, 6-145
dela y F F T-ba sed (F IR) 6-142
a ddin g t o sign a l 2-25 over la p-a dd m et h od 1-22
gr ou p 1-28 u sin g con volu t ion 1-14
n on in t eger 2-26 u sin g filter fu n ct ion 1-16
ph a se 1-28 im pu lse r espon se 1-14, 1-23, 6-196
demod 4-29, 4-30, 6-9, 6-114 in it ia l con dit ion s 1-17
exa m ple 4-30 lin ea r syst em m odels 1-32
dem odu la t ion 4-30, 6-114 n a m es 1-15
exa m ple 4-30 or der 1-15
m et h ods 4-30, 6-114 in st a t e-spa ce r epr esen t a t ion 1-34
design , gen er a lized filt er 2-5 or der est im a t ion
design ed filt er , in SP Tool 5-14 Bu t t er wor t h 6-48
DF T. S ee discr et e F ou r ier t r a n sfor m Ch ebysh ev t ype I 6-55
dftmtx 6-6, 6-117 Ch ebysh ev t ype II 6-60
differ en ce equ a t ion , r ela t ion t o t r a n sfer fu n ct ion ellipt ic 6-132
1-32 equ ir ipple F IR 6-294
differ en t ia t or 2-26, 6-167, 6-289 ph a se dela y 1-28, 6-182
Digit a l Au dio Ta pe st a n da r d 4-20 poles 1-30, 1-33
digit a l filt er r epr esen t a t ion a l m odels 1-32
a n t i-ca u sa l 1-20 r epr esen t in g in MATLAB 1-32
a s con volu t ion m a t r ix 1-40 secon d-or der sect ion s 1-37
Bu t t er wor t h 6-43 specifica t ion s 2-7
ca sca de 1-37 st a r t u p t r a n sien t s 1-21, 1-22
Ch ebysh ev t ype I 6-65 st r u ct u r e
Ch ebysh ev t ype II 6-70 la t t ice 1-37
coefficien t s 1-15 t r a n sposed dir ect for m II 1-17
design 2-2 t im e-dom a in r epr esen t a t ion 1-16
ellipt ic 6-125 t r a n sfer fu n ct ion r epr esen t a t ion 1-15
F IR 2-16 t wo-dim en sion a l 6-148
com pa r ed t o IIR 2-16 zer o-ph a se 1-20, 6-149
fixed-poin t im plem en t a t ion 1-37 zer os 1-30, 1-33
fr equ en cy r espon se 1-24 zer os a n d poles 1-33
gr ou p dela y 1-28, 6-182 S ee also F IR filt er , IIR filt er
I-7
Index
I-8
Index
I-9
Index
I-10
Index
I-11
Index
I-12
Index
I-13
Index
I-14
Index
cla ssica l (a n a log pr ot ot ype) 2-5, 2-8 Im pu lse Respon se ch eck box, F ilt er Viewer 5-86
com pa r ison of filt er t ypes 2-8 im pu lse r espon se plot 5-86, 5-94
gen er a l st eps 2-37 impz 6-3, 6-196
illu st r a t ion 2-37 exa m ple 1-23
in F ilt er Design er 5-76 in dexin g, of vect or s 1-15
or der est im a t ion 2-7 In h er it fr om pop-u p m en u , Spect r u m Viewer
plot t in g pr ot ot ypes 2-12 5-100
sin gle st ep 2-6 in h er it in g pa r a m et er s 5-100
sin gle st ep or der est im a t ion 2-7 in it ia l con dit ion s 1-17, 1-21, 6-150
syst em m odel 2-7 gen er a t in g 1-18
dir ect m et h ods 2-13 In it ia l Type pop-u p m en u , in P r efer en ces dia log
Yu le-Wa lker 2-13 box 5-21
ellipt ic 2-7, 2-10, 5-76, 5-77 in st a n t a n eou s a t t r ibu t es 4-39, 6-187
exa m ple 5-76, 5-77 in t er a ct ive t ools 5-2
gen er a lized Bu t t er wor t h 2-14 ext en ded exa m ple 5-113
in F ilt er Design er 5-59, 5-76 F ilt er Design er 5-2, 5-59, 6-329
m a xim a lly fla t 2-14 F ilt er Viewer 5-2, 5-84, 6-330
pa r a m et er s in F ilt er Design er 5-77 Sign a l Br owser 5-2, 5-43, 6-328
t o specifica t ion s 2-7 Spect r u m Viewer 5-2, 5-97, 6-331
S ee also dir ect design , pa r a m et r ic m odelin g SP Tool 5-2, 6-328
IIR la t t ice filt er , im plem en t a t ion 1-38 interp 6-9, 6-199
im a ge pr ocessin g 6-84 in t er pola t ion 6-199
wit h fft2 a n d ifft2 1-45 F IR filt er design 6-201
impinvar 2-5, 2-42, 6-11, 6-194 in t er va l n ot a t ion xvii
Im por t As pop-u p m en u , in Im por t dia log box 5-9 intfilt 6-6, 6-201
Im por t m en u it em 5-4, 5-6 in ver se com plex cepst r u m 4-25
im por t ed filt er , in SP Tool 5-14 in ver se discr et e cosin e t r a n sfor m 6-190
im pu lse in va r ia n ce 2-42, 6-194 a ccu r a cy of sign a l r econ st r u ct ion 4-38
lim it a t ion s 2-42 in ver se discr et e F ou r ier t r a n sfor m 1-43, 6-192
im pu lse r espon se 1-23, 5-17, 6-196 ifft 1-43
a n d im pu lse in va r ia n ce 2-42 m a t r ix 6-117
com pu t in g wit h filter 1-23 t wo-dim en sion a l 1-45, 6-193
com pu t in g wit h impz 1-23 in ver se filt er design 6-207, 6-266
defin ed 1-23 a n a log 6-203
exa m ple 1-23 digit a l 6-207
of idea l lowpa ss filt er 2-18 in ver se F ou r ier t r a n sfor m , con t in u ou s. S ee sinc
viewin g in F ilt er Viewer 5-94 fu n ct ion
I-15
Index
I-16
Index
ellipt ic 6-125, 6-126 Ma r ker Size edit box, in P r efer en ces dia log box
F IR design , wit h win dow m et h od 2-21 5-21
for decim a t ion 6-110 m a t ch fr equ en cy (for pr ewa r pin g) 6-25
for in t er pola t ion 6-199 MAT-file
idea l im pu lse r espon se 2-18 dpss.mat 3-19
t r a n sla t ion of cu t off fr equ en cy 6-227 im por t in g 1-13
lp2bp 2-5, 2-39, 6-10, 6-220 im por t in g in t o SP Tool 5-4, 5-6
exa m ple 2-40 loa din g in t o SP Tool 5-8
lp2bs 2-5, 2-39, 6-10, 6-223 MAT-file for m a t , con ver t in g t o 1-13
lp2hp 2-5, 2-39, 6-10, 6-225 m a t r ices
lp2lp 2-5, 2-39, 6-10, 6-227 con volu t ion 1-39, 6-86
lpc 2-5, 4-11, 6-8, 6-229 cor r ela t ion coefficien t 6-88
S ee also lin ea r pr edict ive codin g, P r on y’s cova r ia n ce 6-89
m et h od da t a 1-4, 1-7
LP C. S ee lin ea r pr edict ion coefficien t s discr et e F ou r ier t r a n sfor m 6-117
for secon d-or der sect ion s for m 1-37
in ver se discr et e F ou r ier t r a n sfor m 6-117
M m a t r ix for m . S ee st a t e-spa ce for m
m a gn it u de maxflat 2-5, 2-14, 6-5, 6-233
of F ou r ier t r a n sfor m of sequ en ce 1-44 m a xim a , loca l 5-37
of fr equ en cy r espon se 1-26 m a xim a lly fla t 2-14
viewin g in F ilt er Viewer 5-89 m ea su r em en t lin es 5-70
of t r a n sfer fu n ct ion est im a t e 3-15 m ea su r em en t s
vect or 2-24, 6-157, 6-160, 6-376 in F ilt er Viewer 5-37
Ma gn it u de Axis Sca lin g pop-u p m en u , in in Sign a l Br owser 5-37
P r efer en ces dia log box 5-24, 5-25 in Spect r u m Viewer 5-37, 5-101
Ma gn it u de ch eck box, F ilt er Viewer 5-86 sa vin g in F ilt er Viewer 5-37
m a gn it u de plot 5-78 sa vin g in Sign al Br owser 5-37
m a gn it u de plot , in F ilt er Design er 5-69, 5-78 sa vin g in Spect r u m Viewer 5-37
m a gn it u de r espon se 5-17 medfilt1 4-28, 6-9, 6-235
m a gn it u de r espon se plot 5-86, 5-89 m edia n filt er 4-28, 6-235
in F ilt er Design er 5-63 m essa ge sign a l 4-29, 6-236
Ma gn it u de Sca le pop-u p m en u , Spect r u m Viewer Met h od pop-u p m en u , Spect r u m Viewer 5-103
5-100 ME X-file 1-13
m a gn it u de sca le, in Spect r u m Viewer 5-100 M-files 1-3
m a n u fa ct u r in g 4-10 cr ea t in g xii, 1-3
m odifyin g xii
I-17
Index
I-18
Index
or der est im a t ion 2-7, 6-294 P a r ks-McClella n m et h od, F IR filt er design 2-22,
Bu t t er wor t h 6-48 6-287
Ch ebysh ev t ype I 6-55 pa r t ia l fr a ct ion 1-42
Ch ebysh ev t ype II 6-60 pa r t ia l fr a ct ion expa n sion 1-40
ellipt ic 6-132 defin ed 1-35
in F ilt er Design er 5-75, 5-78 det er m in in g wit h residue 1-41
or der select ion 2-7 exa m ple 1-35
in F ilt er Design er 5-75, 5-78 pa r t ia l fr a ct ion for m 1-35, 6-302
or der , of filt er 1-15, 2-7 pa ssba n d
or t h ogon a l win dows, in P SD est im a t es 3-16 equ ir ipple 2-9, 2-10
oscilla t or , volt a ge con t r olled 6-365 gr ou p dela y 2-11
over la p-a dd m et h od, F IR filt er im plem en t a t ion pa ssba n d r ipple, set t in g in F ilt er Design er 5-70
1-22, 6-142 pa ssba n d zoom 5-33
P a ssba n d Zoom bu t t on 5-33
pburg 3-6, 3-21, 6-7, 6-239
P exa m ple 3-21
P a ge Set u p dia log box 5-45, 5-99 pcov 3-6, 3-22, 6-7, 6-243
pa n n er 5-52 exa m ple 3-23
in Sign a l Br owser 5-20, 5-23, 5-48 P ea ks bu t t on , Sign a l Br owser 5-37
P a n n er ch eck box, in P r efer en ces dia log box 5-23 per iodic sin c fu n ct ion 6-118
pa r a m et er s S ee also Dir ich let fu n ct ion
in Spect r u m Viewer 5-99, 5-100, 5-103 per iodogr a m 3-7
in h er it in g in Spect r u m Viewer 5-100 m odified 3-9
pa r a m et r ic m odelin g 4-10, 6-207 per sist en t m ou se zoom in g 5-32
a pplica t ion s 4-10 ph a se
fr equ en cy dom a in ba sed 4-16 com pu t in g wit h angle 6-15
su m m a r y 2-5 of F ou r ier t r a n sfor m of sequ en ce 1-44
t ech n iqu es 4-10 of fr equ en cy r espon se 1-26
t im e dom a in ba sed viewin g in F ilt er Viewer 5-91
lin ea r pr edict ive codin g 4-12, 4-13 of t r a n sfer fu n ct ion est im a t e 3-15
St eiglit z-McBr ide m et h od 4-15 u n wr a ppin g 1-27, 6-360
t im e-dom a in based 4-11 P h a se ch eck box, F ilt er Viewer 5-86
Bu r g m et h od 6-16 ph a se dela y 1-28, 6-182
cova r ia n ce m et h od 6-17 defin ed 1-28
m odified cova r ia n ce m et h od 6-18 exa m ple 1-29
Yu le-Wa lker m et h od 6-19 of lin ea r r espon se filt er 2-17
pa r en t h eses, in dica t in g open in t er va l xvii ph a se dem odu la t ion 6-115
I-19
Index
I-20
Index
I-21
Index
I-22
Index
Ru ler s ch eck box, in P r efer en ces dia log box 5-23, secon d-or der sect ion for m
5-24, 5-26 con ver t in g fr om t r a n sfer fu n ct ion 6-347
con ver t in g fr om zer o-pole-ga in 6-379
secon d-or der sect ion s 1-42
S secon d-or der sect ion s for m 1-36
sa m plin g fr equ en cy con ver t in g fr om st a t e-spa ce for m 6-333
ch a n gin g in SP Tool 5-9 con ver t in g t o st a t e-spa ce 6-316
in SP Tool 5-16 con ver t in g t o t r a n sfer fu n ct ion 6-318
Sa m plin g F r equ en cy edit box, in Im por t dia log box con ver t in g t o zer o-pole-ga in 6-320
5-4, 5-9 defin ed 1-36
Sa m plin g F r equ en cy m en u it em 5-16 filt er in g 6-322
sa m plin g r a t e specifyin g in SP Tool 5-12
ch a n gin g by n on in t eger fa ct or 4-20, 6-298 select in g da t a object s in SP Tool 5-15
ch a n gin g for ir r egu lar ly spa ced da t a 4-22 sequ en ce
ch a n gin g wit h upfirdn 1-19 a u t ocor r ela t ion 6-13, 6-14, 6-262
decr ea sin g by in t eger fa ct or 6-110 set t in gs
in cr ea sin g by in t eger fa ct or 6-199 r est or in g in SP Tool 5-30
Sa ve Ru ler s bu t t on 5-37 r u ler s 5-21
Sa ve Session m en u it em 5-6 sa vin g in Sign al Br owser 5-45
sa vin g ch a n ges in SP Tool 5-30 sa vin g in SP Tool 5-31
sa vin g da t a sgolay 6-309 , 6-311
fr om F ilt er Design er 5-79, 5-110 sgolayfilt 6-311
fr om Sign a l Br owser 5-57 sign a l
sa vin g da t a , fr om F ilt er Design er 5-79, 5-110 a ddin g n oise 1-6
sa vin g da t a , fr om Sign a l Br owser 5-57 a n a lyt ic 4-38, 6-187
sa vin g set t in gs, in F ilt er Viewer 5-86 bu ffer in g 6-33
Sa vit zky-Gola y ca r r ier 4-29, 6-114
filt er design 6-309 com plex 5-47
filt er in g 6-311 con t in u ou s (a n a log) 1-2
sawtooth 1-8, 6-2, 6-308 differ en t ia t ion 2-26
sa wt oot h wa ve 1-8 discr et e (digit a l) 1-2
sca la r gen er a t in g 1-7
for st a t e-spa ce for m 1-34 im por t in g in t o SP Tool 5-3, 5-7, 5-8, 5-10
r epr esen t in g ga in 1-33 lin kin g t o spect r u m 5-100
Sca le pop-u p m en u , F ilt er Viewer 5-87 m ea su r em en t s 5-37
Sea r ch for P lu g-In s a t st a r t -u p ch eck box, in m ea su r em en t s in Sign a l Br owser 5-36
P r efer en ces dia log box 5-30 m essa ge 4-29, 6-236
I-23
Index
I-24
Index
I-25
Index
t ext s, r ela t ed 1-46 con ver t in g fr om secon d-or der sect ion s 6-318
tf2latc 1-39, 1-42, 6-4, 6-346 con ver t in g t o la t t ice 6-346
tf2ss 1-42, 6-4, 6-350 con ver t in g t o secon d-or der sect ion s 6-347
tf2zp 1-42, 6-339, 6-352 con ver t in g t o st a t e-spa ce 6-350
tfe 3-6, 3-14, 6-7, 6-354 specifyin g in SP Tool 5-11
thresh 3-25 t r a n sfor m 4-34
t ilin g 5-88 ch ir p z -t r a n sfor m (CZT) 4-34, 6-105
t ilin g displa y, in F ilt er Viewer 5-26 discr et e cosin e 6-108
t ilin g pr efer en ces, in F ilt er Viewer 5-20 discr et e F ou r ier 1-43
Tim e Respon se Len gt h edit box, in P r efer en ces H ilber t 4-38, 6-187
dia log box 5-25 in ver se discr et e cosin e 4-36, 6-190
t im e r espon se len gt h , in F ilt er Viewer 5-25 in ver se discr et e F ou r ier 6-192
t im e vect or 1-6 t r a n sfor m a t ion s
r et u r n ed by modulate 4-30 bet ween syst em m odels 1-41
t im e-depen den t F ou r ier t r a n sfor m 4-27 bilin ea r 2-43, 6-25
t im e-dom a in a n a lysis, in F ilt er Viewer 5-84 fr equ en cy 2-38, 6-220, 6-223, 6-225, 6-227
t im e-dom a in ba sed m odelin g. S ee pa r a m et r ic t r a n sit ion ba n d 2-23
m odelin g t r a n sposed dir ect for m II 6-145
t oolbox in it ia l con dit ion s 6-150
Con t r ol Syst em s Toolbox 1-35, 6-198, 6-340 triang 4-2, 6-8, 6-358
Im a ge P r ocessin g Toolbox 6-109, 6-190, 6-235 com pa r ed t o bartlett 6-20
Sign a l P r ocessin g Toolbox 1-2 exa m ple 4-2
Sym bolic Ma t h Toolbox 6-21 t r ia n gu la r win dow 6-358
Syst em Iden t ifica t ion Toolbox 6-357 tripuls 6-2, 6-359
Tr a ck bu t t on , for r u ler s 5-36, 5-38, 5-40 t wo-dim en sion a l oper a t ion s
t r a n sfer fu n ct ion 1-32, 1-35, 1-40, 1-42 a u t ocor r ela t ion 6-372
coefficien t s 1-15, 5-79 con volu t ion 6-84
defin ed 1-15 obt a in in g su bsect ion 6-84
der iva t ion 1-15 cr oss-cor r ela t ion 6-372
est im a t e fr om in pu t a n d ou t pu t 6-354 discr et e F ou r ier t r a n sfor m 1-45, 6-141
est im a t in g u sin g Welch ’s m et h od 3-14 filt er in g 6-148
expor t in g fr om SP Tool 5-79 in ver se discr et e F ou r ier t r a n sfor m 1-45, 6-193
fa ct or ed for m 1-33 t wo-dim en sion a l sign a l pr ocessin g, wit h fft2 a n d
for a n a log filt er 1-41 ifft2 1-45
r epr esen t in g in MATLAB 1-32
zer o-pole-ga in for m 1-33
t r a n sfer fu n ct ion for m
I-26
Index
U ch ir p 1-9
u n it cir cle 6-265 ch ir p, exa m ple 1-9
u n it im pu lse fu n ct ion 1-7 fr om sin u soids 1-6
u n it r a m p fu n ct ion 1-7 gen er a t in g wit h diric fu n ct ion 1-11
u n it sa m ple, m u lt ich a n n el r epr esen t a t ion 1-7 gen er a t in g wit h pulstran 1-9
u n it st ep fu n ct ion 1-7 gen er a t in g wit h sinc fu n ct ion 1-10
u n it s of power spect r a l den sit y (P SD) fu n ct ion lin ea r swept -fr equ en cy cosin e. S ee ch ir p
3-11 per iodic 1-7
unwrap 1-27, 6-3, 6-360 sa wt oot h 1-8, 6-308
U pda t e bu t t on 5-19, 5-97 exa m ple 1-8
upfirdn 1-19, 4-22, 6-10, 6-361 sin u soida l pu lse, Ga u ssia n -m odu la t ed 1-8
squ a r e 1-8, 6-332
t r ia n gle 6-308
V Welch ’s m et h od 3-6
Va lleys bu t t on , Sign a l Br owser 5-37 bia s 3-12
va r ia n ce com pa r ed t o t h e Bu r g m et h od 3-22
of cor r ela t ion sequ en ce est im a t e 3-4 com pa r ed t o t h e MTM m et h od 3-19
of power spect r u m est im a t e 3-8 com pa r ed t o t h e Yu le-Wa lker AR m et h od 3-20
vco 4-29, 4-31, 6-10, 6-365 for cr oss spect r a l den sit y est im a t ion 3-14,
vect or 6-102
da t a 1-4 for n on pa r a m et r ic syst em iden t ifica t ion 3-14
displa y, in Sign a l Br owser 5-50 for power spect r a l den sit y est im a t ion 3-5, 3-10,
for filt er coefficien t s 1-16, 1-32 6-81, 6-275
fr equ en cy 2-24, 6-157, 6-160, 6-287, 6-376 in Spect r u m Viewer 5-106
in SP Tool 5-14 n or m a liza t ion 3-12
in dexin g xvii, 1-15 wh it e n oise 1-6
m a gn it u de 2-24, 6-157, 6-160, 6-376 win dow
t im e 1-6 a pplied t o per iodogr a m 3-9
weigh t in g 2-24, 6-167, 6-288 Ba r t let t 4-2, 6-20
Ver t ica l bu t t on , for r u ler s 5-36, 5-38 Bla ckm a n 4-4, 6-30
View bu t t on 5-17, 5-19 boxca r 2-18
volt a ge con t r olled oscilla t or 4-31, 6-365 Ch ebysh ev 4-9, 6-64
for filt er design 2-18
gen er a lized cosin e 4-4
W H a m m in g 2-20, 4-4, 6-185
wa vefor m H a n n in g 4-4, 6-186
a per iodic 1-8 Ka iser 4-4, 6-210
I-27
Index
I-28
Index
ch a n gin g 5-32
in F ilt er Design er 5-27
in F ilt er Viewer 5-26, 5-87
in Sign a l Br owser 5-23, 5-46
in Spect r u m Viewer 5-24
zoom in g
in F ilt er Design er 5-77
in F ilt er Viewer 5-87
in Sign a l Br owser 5-46
in Spect r u m Viewer 5-103
on e-t im e 5-32
per sist en t 5-32
zp2sos 1-42, 6-4, 6-379
zp2ss 1-42, 6-4, 6-383
zp2tf 1-42, 6-384
zplane 1-30, 6-3, 6-385
z -t r a n sfor m 1-15, 1-32
ch ir p z -t r a n sfor m (CZT) 4-34, 6-105
discr et e F ou r ier t r a n sfor m 1-43
I-29
Index
I-30