Filter Structure and System Model Available in MATLAB
7.2.3 Filter Structure and System Model Available in MATLAB
Figure 7.23 shows various filter structures that can be constructed, realized, and cast into a Simulink block by using FDATool or the dfilt()/realizemdl() command (see Sect. E.15). Note that all of the (transposed) direct I and II forms in Fig. 7.23(a)–(d) commonly have the following system function
b m1 y[n] U[z]
u[n] b m1
y[n]
u[n]
Y[z] z –1
Y[z] U[z]
(a) Direct I form – SOS (cascade) (b) Transposed direct I form – SOS (cascade) u[n]
b m1 y[n] U[z]
z U[z] z –1 Y[z]
(c) Direct II form – SOS (cascade) (d) Transposed direct II form – SOS (cascade) u[n]
U[z] –r N
p 3 p 2 p 1 y[n] Y[z]
(e) Lattice/ladder –ARMA form
u[n] U[z]
–r N r N –r 2 r 2 –r 1 r 1
All–pass output All-pole output y [n]
(f) IIR lattice form
u[n] y [n] U[z]
1 [z] 1 r 1 r 2 r 2 r N
r N Minimum-phase output Maximum-phase
output y [n] z –1
(g) FIR lattice form
Fig. 7.23 Various filter structures
346 7 Analog and Digital Filters
(h) Direct I form (i) Direct II form u [n] z –1
( j1) Direct symmetric form with an even order (j2) Direct symmetric form with an odd order u [n ] z –1
(k1) Direct asymmetric form with an even order (k2) Direct asymmetric form with an odd order
Fig. 7.23 (continued)
+b z+b [z] = K G M+1
G [z] Π G M+1,1
z+a M+1,2
m=1
z 2 +a m 2 z+a m 3
with M = floor( )
MATLAB represents the SOSs (second-order sections) connected in cascade (with the output of each stage applied into the input of the next stage) as an M × 6
array ‘SOS’, each row of which contains the numerator and denominator coefficient
vector [b m 1 b m 2 b m 3 1a m 2 a m 3 ] of a single section.
MATLAB provides several functions that can be used for conversion between the various linear system models as listed in Table 7.3. Converting from one system model or filter structure to another may yield a result with different characteristic than the original due to the computer’s finite-precision arithmetic operations and the variations in the conversion’s round-off computations.
7.2 Digital
Filter Design
Table 7.3 MATLAB functions for conversion between the various linear system models System Function
SOS (parallel) Lattice System Function
State-Space
Zero-Pole-Gain
SOS (cascade)
tf2par z() ∗ tf2latc() State-Space
tf2ss()
tf2zp()
tf2sos()
None Zero-Pole-Gain
ss2tf()
ss2zp()
ss2sos()
None
None SOS (cascade)
zp2tf()
zp2ss()
zp2sos()
None
None SOS (parallel)
sos2tf()
sos2ss()
sos2zp()
None
None Lattice
par2tf() ∗
— (cf) ∗ means that the MATLAB function is fabricated in this book.
latc2tf()
None
None
None
None
348 7 Analog and Digital Filters In the Filter Design & Analysis window (Fig. 7.24(a)) opened by typing ‘fdatool’
in the MATLAB command window, we can convert the structure of a designed filter through the Convert Structure dialog box (Fig. 7.24(b1)) opened by clicking Edit/Convert Structure (Fig. 7.24(b)) on the top menu bar. The following structures are available for conversion in MATLAB:
- Direct form I, Direct form II, Direct form I transposed, or Direct form II transposed - Second-Order Sections - Lattice minimum/maximum phase from minimum/maximum-phase FIR filter - Lattice allpass from Allpass filter - Lattice ARMA from IIR filter - State-Space model
The MATLAB function dfilt() can also be used to convert the filter structure. For example,
>>B=firls(30,[0 .5 .6 1],[0 0 1 1]); Gd1=dfilt.dffir(B); %direct-form FIR >>[B,A]=butter(7,0.2); Gd2=dfilt.df2tsos(tf2sos(B,A)); %direct IIt-SOS IIR >>Gd par=dfilt.parallel(Gd1,Gd2); %parallel structure of two or more objects >>realizemdl(Gd par) % To create Simulink model >>fvtool(Gd1,Gd2,Gd par) % To analyze filter