Biomedical Engineering Reference
In-Depth Information
equations. The role played by the
z
-transform in the solution of difference equations cor-
responds to that played by the Laplace transforms in the solution of differential equations.
The transfer function
H
is easily obtained from the difference equation. The first
step involves taking the Fourier transform before using the linearity property to move the
transform to within the summation. The time-shifting property of the z-transform is used
to change the time shifting terms to exponentials.
For
a
o
=
(
z
)
1, this process results in
M
N
b
k
X
(
z
)
z
−
k
−
a
k
Y
(
z
)
z
−
k
Y
(
z
)
=
(5.32)
k
=
0
k
=
1
The transfer function
H
(
z
)
is then
k
=
0
b
k
z
−
k
M
Y
(
z
)
X
H
(
z
)
=
)
=
(5.33)
k
=
1
a
k
z
−
k
(
z
N
1
+
The frequency response is then obtained by replacing every instance of
z
with
e
j
ω
.
k
=
0
b
k
e
−
j
ω
k
N
M
H
(ω)
=
(5.34)
k
=
0
a
k
e
−
j
ω
k
Fortunately, this process of obtaining the transfer function is easily achieved in MATLAB.
WORKED EXAMPLE
Obtaining a Filter Transfer Function Using MATLAB
The difference equation for a Butterworth low-pass filter can be written in terms of
y
(
n
)
=
0
.
0029
x
(
n
)
+
0
.
0087
x
(
n
−
1
)
+
0
.
0087
x
(
n
−
2
)
+
0
.
0029
x
(
n
−
3
)
]
The coefficients of the difference equation can be written in as arrays, where
A
includes the
coefficients of
y
−
[2
.
3741
y
(
n
−
1
)
−
1
.
9294
y
(
n
−
2
)
+
0
.
5321
y
(
n
−
3
)
,
and
B
includes the coefficients of
x
A
=
(
a
0
,
a
1
,
a
2
,
a
3
)
B
=
(
b
0
,
b
1
,
b
2
,
b
3
)
Remember that
a
0
=
1, so
=
(
,
−
.
,
.
,
−
.
)
A
1
2
3741
1
9294
0
5321
)
The frequency response can then be obtained and plotted, as shown in Figure 5-52, using the
following MATLAB code:
B
=
(
0
.
0029
,
0
.
0087
,
0
.
0087
,
0
.
0029
[h,w] = freqz(B,A,512); % extract the transfer function from DC to fs/2
freq = (0:511)/512;
plot(freq,abs(h));
xlabel('Normalized Frequency')
ylabel('
|
|
H(w)
')