Digital Signal Processing Reference
In-Depth Information
1
x
()
+
y(n)
1.
−
1
+
xn
(
−
1
)
−
1
0
36
.
xn
(
−
2
)
FIGURE 7.40
FIR filter realization for Example 7.18.
Program 7.12. MATLAB program for Example 7.18.
% Sample MATLAB code
sample
¼
1:1:10;
% Input test array
x
¼
[ 0 0 0];
% Input buffer [x(n) x(n-1)
.
]
y
¼
[0];
%output buffer [y(n) y(n-1)
.
]
b
¼
[1.0 1.2 0.36];
% FIR filter coefficients [b0 b1
]
.
KK
length(b);
for n
¼
¼
1:1:length(sample)
% Loop processing
for k
¼
KK:-1:2
% Shift input by one sample
x(k)
¼
x(k-1);
end
x(1)
¼
sample(n);
% Get new sample
y(1)
¼
0;
% Perform FIR filtering
for k
¼
1:1:KK
y(1)
¼
y(1)
þ
b(k)*x(k);
end
out(n)
¼
y(1); %send filtered sample to the output array
end
out
7.7.2
Linear Phase Form
We illustrate the linear phase structure using the following simple example.
Consider the following transfer function with 5 taps obtained from the design:
HðzÞ¼b
0
þ b
1
z
1
þ b
2
z
2
þ b
1
z
3
þ b
0
z
4
(7.39)
We can see that the coefficients are symmetrical and the difference equation is
yðnÞ¼b
0
xðnÞþb
1
xðn
1
Þþb
2
xðn
2
Þþb
1
xðn
3
Þþb
0
xðn
4
Þ
This DSP equation can further be combined to yield
yðnÞ¼b
0
ðxðnÞþxðn
4
ÞÞ þ b
1
ðxðn
1
Þþxðn
3
ÞÞ þ b
2
xðn
2
Þ
Then we obtain the realization structure in a linear phase form as shown in
Figure 7.41
.
Search WWH ::
Custom Search