Sie sind auf Seite 1von 8

DSP: All-Pass Filter Design Example

Digital Signal Processing


All-Pass Filter Design Example

D. Richard Brown III

D. Richard Brown III 1/8


DSP: All-Pass Filter Design Example

Problem Setup

We are given a causal stable IIR low-pass filter


1−α
2 (1 + z −1 )
H(z) =
1 − αz −1
with α = 0.5. We can realize and analyze this filter in Matlab with

w = pi*[0:0.001:1]; % normalized frequencies


alpha = 0.5; % LPF parameter
blp = (1-alpha)/2*[1 1]; % numerator coefficients
alp = [1 -alpha]; % denominator coefficients
hlp = freqz(blp,alp,w); % compute DTFT
glp = grpdelay(blp,alp,w); % compute group delay

D. Richard Brown III 2/8


DSP: All-Pass Filter Design Example

Low-Pass Filter Frequency Response


1
magnitude response

0.5

0
0 0.5 1 1.5 2 2.5 3 3.5

0
phase response (rad)

−0.5

−1

−1.5

−2
0 0.5 1 1.5 2 2.5 3 3.5

1.5
group delay (samples)

0.5

0
0 0.5 1 1.5 2 2.5 3 3.5
normalized freq (rad/sample)

D. Richard Brown III 3/8


DSP: All-Pass Filter Design Example

All-Pass Filter Design to Linearize Phase Response

We will cascade a causal all-pass filter with the LPF to linearize the phase
response and equalize the group delay in the passband. We can do this in Matlab
with

N = 4; % all-pass filter order


F = w(1:501)/pi; % normalized frequencies
edges = [0 1/2]; % band-edge frequencies
Gd = max(glp)-glp(1:501); % desired group-delays of APF (>0)
[bap,aap] = iirgrpdelay(N,F,edges,Gd); % make all-pass filter
hap = freqz(bap,aap,w); % compute DTFT
gap = grpdelay(bap,aap,w); % compute group-delay

D. Richard Brown III 4/8


DSP: All-Pass Filter Design Example

All-Pass Filter z-plane

1.5

0.5
Imaginary Part

−0.5

−1

−1.5

−2

−2 −1.5 −1 −0.5 0 0.5 1 1.5 2 2.5 3


Real Part

D. Richard Brown III 5/8


DSP: All-Pass Filter Design Example

All-Pass Filter Frequency Response


1
magnitude response
1

1
0 0.5 1 1.5 2 2.5 3 3.5

0
phase response (rad)

−5

−10

−15
0 0.5 1 1.5 2 2.5 3 3.5

6
group delay (samples)

2
0 0.5 1 1.5 2 2.5 3 3.5
normalized freq (rad/sample)

D. Richard Brown III 6/8


DSP: All-Pass Filter Design Example

Compute and Plot Cascaded Response


We can do this in Matlab with
b = conv(blp,bap); % product of numerators
a = conv(alp,aap); % product of denominators
h = freqz(b,a,w); % compute DTFT
g = grpdelay(b,a,w); % compute group delay
subplot(3,1,1)
plot(w,abs(h));
ylabel(’magnitude response’);
subplot(3,1,2);
plot(w,unwrap(angle(h)));
ylabel(’phase response (rad)’);
subplot(3,1,3);
plot(w,g);
xlabel(’normalized freq (rad/sample)’);
ylabel(’group delay (samples)’);
D. Richard Brown III 7/8
DSP: All-Pass Filter Design Example

Cascaded LPF-AP Frequency Response


magnitude response 1

0.5

0
0 0.5 1 1.5 2 2.5 3 3.5

0
phase response (rad)

−5

−10

−15
0 0.5 1 1.5 2 2.5 3 3.5

6
group delay (samples)

2
0 0.5 1 1.5 2 2.5 3 3.5
normalized freq (rad/sample)

D. Richard Brown III 8/8

Das könnte Ihnen auch gefallen