Graphics Programs Reference
In-Depth Information
Input signal x(t)
b
i
T
Output signal y(t)
+
+
a
i
T
Fig. 6.2
Schematic of a linear time-invariant fi lter with an input
x
(
t
) and an output
y
(
t
). The
fi lter is characterized by its weights
a
i
and
b
i
, and the delay elements
T
. Nonrecursive fi lters
only have nonrecursive weights
b
i
, whereas the recursive fi lter also requires the recursive
fi lters weights
a
i
.
with the known problems in the design of zero-phase fi lters. The larger of
the two quantities
M
and
N
1
+
N
2
or
N
, respectively, is the order of the fi lter.
We use the same synthetic input signal as in the previous example to il-
lustrate the performance of a recursive fi lter.
clear
t = (1:100)';
randn('seed',0);
x5 = randn(100,1);
We fi lter this input using a recursive fi lter with a set of weights
a5
and
b5
,
b5 = [0.0048 0.0193 0.0289 0.0193 0.0048];
a5 = [1.0000 -2.3695 2.3140 -1.0547 0.1874];
m5 = length(b5);
y5 = filter(b5,a5,x5);
and correct the output for the phase
y5= y5(1+(m5-1)/2:end-(m5-1)/2,1);
y5(end+1:end+m5-1,1)=zeros(m5-1,1);
Now we plot the results.
plot(t,x5,'b-',t,y5,'r-')