7: optimal fir filtersalternation theorem 7: optimal fir filters •optimal filters •alternation...

93
7: Optimal FIR filters 7: Optimal FIR filters Optimal Filters Alternation Theorem Chebyshev Polynomials Maximal Error Locations Remez Exchange Algorithm Determine Polynomial Example Design FIR Pros and Cons Summary MATLAB routines DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 1 / 11

Upload: others

Post on 27-Sep-2020

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

7: Optimal FIR filters

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 1 / 11

Page 2: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Optimal Filters

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 2 / 11

We restrict ourselves to zero-phase filters of odd length M + 1, symmetricaround h[0], i.e. h[−n] = h[n].

Page 3: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Optimal Filters

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 2 / 11

We restrict ourselves to zero-phase filters of odd length M + 1, symmetricaround h[0], i.e. h[−n] = h[n].

H(ω) = H(ejω) =∑

M2

−M2

h[n]e−jnω

Page 4: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Optimal Filters

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 2 / 11

We restrict ourselves to zero-phase filters of odd length M + 1, symmetricaround h[0], i.e. h[−n] = h[n].

H(ω) = H(ejω) =∑

M2

−M2

h[n]e−jnω= h[0] + 2∑

M2

1 h[n] cosnω

Page 5: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Optimal Filters

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 2 / 11

We restrict ourselves to zero-phase filters of odd length M + 1, symmetricaround h[0], i.e. h[−n] = h[n].

H(ω) = H(ejω) =∑

M2

−M2

h[n]e−jnω= h[0] + 2∑

M2

1 h[n] cosnω

H(ω) is real but not necessarily positive (unlike∣

∣H(ejω)∣

∣).

Page 6: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Optimal Filters

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 2 / 11

We restrict ourselves to zero-phase filters of odd length M + 1, symmetricaround h[0], i.e. h[−n] = h[n].

H(ω) = H(ejω) =∑

M2

−M2

h[n]e−jnω= h[0] + 2∑

M2

1 h[n] cosnω

H(ω) is real but not necessarily positive (unlike∣

∣H(ejω)∣

∣).

Weighted error: e(ω) = s(ω)(

H(ω)− d(ω))

where d(ω) is the target.

Page 7: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Optimal Filters

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 2 / 11

We restrict ourselves to zero-phase filters of odd length M + 1, symmetricaround h[0], i.e. h[−n] = h[n].

H(ω) = H(ejω) =∑

M2

−M2

h[n]e−jnω= h[0] + 2∑

M2

1 h[n] cosnω

H(ω) is real but not necessarily positive (unlike∣

∣H(ejω)∣

∣).

Weighted error: e(ω) = s(ω)(

H(ω)− d(ω))

where d(ω) is the target.Choose s(ω) to control the error variation with ω.

Page 8: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Optimal Filters

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 2 / 11

We restrict ourselves to zero-phase filters of odd length M + 1, symmetricaround h[0], i.e. h[−n] = h[n].

H(ω) = H(ejω) =∑

M2

−M2

h[n]e−jnω= h[0] + 2∑

M2

1 h[n] cosnω

H(ω) is real but not necessarily positive (unlike∣

∣H(ejω)∣

∣).

Weighted error: e(ω) = s(ω)(

H(ω)− d(ω))

where d(ω) is the target.Choose s(ω) to control the error variation with ω.

Example: lowpass filter

Page 9: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Optimal Filters

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 2 / 11

We restrict ourselves to zero-phase filters of odd length M + 1, symmetricaround h[0], i.e. h[−n] = h[n].

H(ω) = H(ejω) =∑

M2

−M2

h[n]e−jnω= h[0] + 2∑

M2

1 h[n] cosnω

H(ω) is real but not necessarily positive (unlike∣

∣H(ejω)∣

∣).

Weighted error: e(ω) = s(ω)(

H(ω)− d(ω))

where d(ω) is the target.Choose s(ω) to control the error variation with ω.

Example: lowpass filter

d(ω) =

1 0 ≤ ω ≤ ω1

0 ω2 ≤ ω ≤ π

Page 10: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Optimal Filters

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 2 / 11

We restrict ourselves to zero-phase filters of odd length M + 1, symmetricaround h[0], i.e. h[−n] = h[n].

H(ω) = H(ejω) =∑

M2

−M2

h[n]e−jnω= h[0] + 2∑

M2

1 h[n] cosnω

H(ω) is real but not necessarily positive (unlike∣

∣H(ejω)∣

∣).

Weighted error: e(ω) = s(ω)(

H(ω)− d(ω))

where d(ω) is the target.Choose s(ω) to control the error variation with ω.

Example: lowpass filter

d(ω) =

1 0 ≤ ω ≤ ω1

0 ω2 ≤ ω ≤ π

s(ω) =

δ−1 0 ≤ ω ≤ ω1

ǫ−1 ω2 ≤ ω ≤ π

Page 11: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Optimal Filters

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 2 / 11

We restrict ourselves to zero-phase filters of odd length M + 1, symmetricaround h[0], i.e. h[−n] = h[n].

H(ω) = H(ejω) =∑

M2

−M2

h[n]e−jnω= h[0] + 2∑

M2

1 h[n] cosnω

H(ω) is real but not necessarily positive (unlike∣

∣H(ejω)∣

∣).

Weighted error: e(ω) = s(ω)(

H(ω)− d(ω))

where d(ω) is the target.Choose s(ω) to control the error variation with ω.

Example: lowpass filter

d(ω) =

1 0 ≤ ω ≤ ω1

0 ω2 ≤ ω ≤ π

s(ω) =

δ−1 0 ≤ ω ≤ ω1

ǫ−1 ω2 ≤ ω ≤ π

e(ω) = ±1 when H(ω) lies at the edge of the specification.

Page 12: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Optimal Filters

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 2 / 11

We restrict ourselves to zero-phase filters of odd length M + 1, symmetricaround h[0], i.e. h[−n] = h[n].

H(ω) = H(ejω) =∑

M2

−M2

h[n]e−jnω= h[0] + 2∑

M2

1 h[n] cosnω

H(ω) is real but not necessarily positive (unlike∣

∣H(ejω)∣

∣).

Weighted error: e(ω) = s(ω)(

H(ω)− d(ω))

where d(ω) is the target.Choose s(ω) to control the error variation with ω.

Example: lowpass filter

d(ω) =

1 0 ≤ ω ≤ ω1

0 ω2 ≤ ω ≤ π

s(ω) =

δ−1 0 ≤ ω ≤ ω1

ǫ−1 ω2 ≤ ω ≤ π

e(ω) = ±1 when H(ω) lies at the edge of the specification.

Minimax criterion: h[n] = argminh[n] maxω |e(ω)|: minimize max error

Page 13: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Alternation Theorem

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 3 / 11

Want to find the best fit line: with the smallest maximal error.

2 4 6 82

4

6

8

Page 14: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Alternation Theorem

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 3 / 11

Want to find the best fit line: with the smallest maximal error.

Best fit line always attains themaximal error three times withalternate signs

2 4 6 82

4

6

8

Page 15: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Alternation Theorem

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 3 / 11

Want to find the best fit line: with the smallest maximal error.

Best fit line always attains themaximal error three times withalternate signs

2 4 6 82

4

6

8

Proof:Assume the first maximal deviation from the line is negative as shown.

Page 16: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Alternation Theorem

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 3 / 11

Want to find the best fit line: with the smallest maximal error.

Best fit line always attains themaximal error three times withalternate signs

2 4 6 82

4

6

8

Proof:Assume the first maximal deviation from the line is negative as shown.There must be an equally large positive deviation; or else just move the linedownwards to reduce the maximal deviation.

Page 17: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Alternation Theorem

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 3 / 11

Want to find the best fit line: with the smallest maximal error.

Best fit line always attains themaximal error three times withalternate signs

2 4 6 82

4

6

8

Proof:Assume the first maximal deviation from the line is negative as shown.There must be an equally large positive deviation; or else just move the linedownwards to reduce the maximal deviation.This must be followed by another maximal negative deviation; or else youcan rotate the line and reduce the deviations.

Page 18: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Alternation Theorem

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 3 / 11

Want to find the best fit line: with the smallest maximal error.

Best fit line always attains themaximal error three times withalternate signs

2 4 6 82

4

6

8

Proof:Assume the first maximal deviation from the line is negative as shown.There must be an equally large positive deviation; or else just move the linedownwards to reduce the maximal deviation.This must be followed by another maximal negative deviation; or else youcan rotate the line and reduce the deviations.

Alternation Theorem:A polynomial fit of degree n to a set of bounded points is minimax if andonly if it attains its maximal error at n+ 2 points with alternating signs.

Page 19: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Alternation Theorem

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 3 / 11

Want to find the best fit line: with the smallest maximal error.

Best fit line always attains themaximal error three times withalternate signs

2 4 6 82

4

6

8

Proof:Assume the first maximal deviation from the line is negative as shown.There must be an equally large positive deviation; or else just move the linedownwards to reduce the maximal deviation.This must be followed by another maximal negative deviation; or else youcan rotate the line and reduce the deviations.

Alternation Theorem:A polynomial fit of degree n to a set of bounded points is minimax if andonly if it attains its maximal error at n+ 2 points with alternating signs.There may be additional maximal error points.

Page 20: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Alternation Theorem

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 3 / 11

Want to find the best fit line: with the smallest maximal error.

Best fit line always attains themaximal error three times withalternate signs

2 4 6 82

4

6

8

Proof:Assume the first maximal deviation from the line is negative as shown.There must be an equally large positive deviation; or else just move the linedownwards to reduce the maximal deviation.This must be followed by another maximal negative deviation; or else youcan rotate the line and reduce the deviations.

Alternation Theorem:A polynomial fit of degree n to a set of bounded points is minimax if andonly if it attains its maximal error at n+ 2 points with alternating signs.There may be additional maximal error points.Fitting to a continuous function is the same as to an infinite number ofpoints.

Page 21: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Chebyshev Polynomials

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 4 / 11

H(ω) = H(ejω) = h[0] + 2∑

M2

1 h[n] cosnω

Page 22: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Chebyshev Polynomials

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 4 / 11

H(ω) = H(ejω) = h[0] + 2∑

M2

1 h[n] cosnω

But

cos 2ω = 2 cos2 ω − 1

Page 23: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Chebyshev Polynomials

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 4 / 11

H(ω) = H(ejω) = h[0] + 2∑

M2

1 h[n] cosnω

But

cos 2ω = 2 cos2 ω − 1cos 3ω = 4 cos3 ω − 3 cosω

Page 24: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Chebyshev Polynomials

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 4 / 11

H(ω) = H(ejω) = h[0] + 2∑

M2

1 h[n] cosnω

But cosnω = Tn(cosω): Chebyshev polynomial of 1st kind

cos 2ω = 2 cos2 ω − 1 = T2(cosω) T2(x) = 2x2 − 1cos 3ω = 4 cos3 ω − 3 cosω = T3(cosω) T3(x) = 4x3 − 3x

Page 25: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Chebyshev Polynomials

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 4 / 11

H(ω) = H(ejω) = h[0] + 2∑

M2

1 h[n] cosnω

But cosnω = Tn(cosω): Chebyshev polynomial of 1st kind

cos 2ω = 2 cos2 ω − 1 = T2(cosω) T2(x) = 2x2 − 1cos 3ω = 4 cos3 ω − 3 cosω = T3(cosω) T3(x) = 4x3 − 3x

Recurrence Relation:Tn+1(x) = 2xTn(x)− Tn−1(x) with T0(x) = 1, T1(x) = x

Page 26: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Chebyshev Polynomials

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 4 / 11

H(ω) = H(ejω) = h[0] + 2∑

M2

1 h[n] cosnω

But cosnω = Tn(cosω): Chebyshev polynomial of 1st kind

cos 2ω = 2 cos2 ω − 1 = T2(cosω) T2(x) = 2x2 − 1cos 3ω = 4 cos3 ω − 3 cosω = T3(cosω) T3(x) = 4x3 − 3x

Recurrence Relation:Tn+1(x) = 2xTn(x)− Tn−1(x) with T0(x) = 1, T1(x) = x

Proof: cos (nω + ω) + cos (nω − ω) = 2 cosω cosnω

Page 27: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Chebyshev Polynomials

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 4 / 11

H(ω) = H(ejω) = h[0] + 2∑

M2

1 h[n] cosnω

But cosnω = Tn(cosω): Chebyshev polynomial of 1st kind

cos 2ω = 2 cos2 ω − 1 = T2(cosω) T2(x) = 2x2 − 1cos 3ω = 4 cos3 ω − 3 cosω = T3(cosω) T3(x) = 4x3 − 3x

Recurrence Relation:Tn+1(x) = 2xTn(x)− Tn−1(x) with T0(x) = 1, T1(x) = x

Proof: cos (nω + ω) + cos (nω − ω) = 2 cosω cosnω

So H(ω) is an M2 order polynomial in cosω: alternation theorem applies.

Page 28: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Chebyshev Polynomials

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 4 / 11

H(ω) = H(ejω) = h[0] + 2∑

M2

1 h[n] cosnω

But cosnω = Tn(cosω): Chebyshev polynomial of 1st kind

cos 2ω = 2 cos2 ω − 1 = T2(cosω) T2(x) = 2x2 − 1cos 3ω = 4 cos3 ω − 3 cosω = T3(cosω) T3(x) = 4x3 − 3x

Recurrence Relation:Tn+1(x) = 2xTn(x)− Tn−1(x) with T0(x) = 1, T1(x) = x

Proof: cos (nω + ω) + cos (nω − ω) = 2 cosω cosnω

So H(ω) is an M2 order polynomial in cosω: alternation theorem applies.

Example: Symmetric lowpass filter of orderM = 4H(z) = 0.1766z2 + 0.4015z + 0.2124 + 0.4015z−1 + 0.1766z−2

Page 29: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Chebyshev Polynomials

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 4 / 11

H(ω) = H(ejω) = h[0] + 2∑

M2

1 h[n] cosnω

But cosnω = Tn(cosω): Chebyshev polynomial of 1st kind

cos 2ω = 2 cos2 ω − 1 = T2(cosω) T2(x) = 2x2 − 1cos 3ω = 4 cos3 ω − 3 cosω = T3(cosω) T3(x) = 4x3 − 3x

Recurrence Relation:Tn+1(x) = 2xTn(x)− Tn−1(x) with T0(x) = 1, T1(x) = x

Proof: cos (nω + ω) + cos (nω − ω) = 2 cosω cosnω

So H(ω) is an M2 order polynomial in cosω: alternation theorem applies.

Example: Symmetric lowpass filter of orderM = 4H(z) = 0.1766z2 + 0.4015z + 0.2124 + 0.4015z−1 + 0.1766z−2

Page 30: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Chebyshev Polynomials

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 4 / 11

H(ω) = H(ejω) = h[0] + 2∑

M2

1 h[n] cosnω

But cosnω = Tn(cosω): Chebyshev polynomial of 1st kind

cos 2ω = 2 cos2 ω − 1 = T2(cosω) T2(x) = 2x2 − 1cos 3ω = 4 cos3 ω − 3 cosω = T3(cosω) T3(x) = 4x3 − 3x

Recurrence Relation:Tn+1(x) = 2xTn(x)− Tn−1(x) with T0(x) = 1, T1(x) = x

Proof: cos (nω + ω) + cos (nω − ω) = 2 cosω cosnω

So H(ω) is an M2 order polynomial in cosω: alternation theorem applies.

Example: Symmetric lowpass filter of orderM = 4H(z) = 0.1766z2 + 0.4015z + 0.2124 + 0.4015z−1 + 0.1766z−2

Page 31: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Maximal Error Locations

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 5 / 11

Maximal error locations occur either at bandedges or when dH

dω= 0

0 0.5 1 1.5 2 2.5 30

0.2

0.4

0.6

0.8

1

1.2

ω

|H|

M=18

Page 32: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Maximal Error Locations

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 5 / 11

Maximal error locations occur either at bandedges or when dH

dω= 0

0 0.5 1 1.5 2 2.5 30

0.2

0.4

0.6

0.8

1

1.2

ω

|H|

M=18

Page 33: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Maximal Error Locations

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 5 / 11

Maximal error locations occur either at bandedges or when dH

dω= 0

H(ω) = h[0] + 2∑

M2

1 h[n] cosnω

0 0.5 1 1.5 2 2.5 30

0.2

0.4

0.6

0.8

1

1.2

ω

|H|

M=18

Page 34: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Maximal Error Locations

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 5 / 11

Maximal error locations occur either at bandedges or when dH

dω= 0

H(ω) = h[0] + 2∑

M2

1 h[n] cosnω= P (cosω)

where P (x) is a polynomial of order M2 . 0 0.5 1 1.5 2 2.5 3

0

0.2

0.4

0.6

0.8

1

1.2

ω

|H|

M=18

Page 35: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Maximal Error Locations

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 5 / 11

Maximal error locations occur either at bandedges or when dH

dω= 0

H(ω) = h[0] + 2∑

M2

1 h[n] cosnω= P (cosω)

where P (x) is a polynomial of order M2 . 0 0.5 1 1.5 2 2.5 3

0

0.2

0.4

0.6

0.8

1

1.2

ω

|H|

M=18

dHdω

= −P ′(cosω) sinω

Page 36: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Maximal Error Locations

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 5 / 11

Maximal error locations occur either at bandedges or when dH

dω= 0

H(ω) = h[0] + 2∑

M2

1 h[n] cosnω= P (cosω)

where P (x) is a polynomial of order M2 . 0 0.5 1 1.5 2 2.5 3

0

0.2

0.4

0.6

0.8

1

1.2

ω

|H|

M=18

dHdω

= −P ′(cosω) sinω

= 0 at ω = 0, π and at most M2 − 1 zeros of polynomial P ′(x).

Page 37: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Maximal Error Locations

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 5 / 11

Maximal error locations occur either at bandedges or when dH

dω= 0

H(ω) = h[0] + 2∑

M2

1 h[n] cosnω= P (cosω)

where P (x) is a polynomial of order M2 . 0 0.5 1 1.5 2 2.5 3

0

0.2

0.4

0.6

0.8

1

1.2

ω

|H|

M=18

dHdω

= −P ′(cosω) sinω

= 0 at ω = 0, π and at most M2 − 1 zeros of polynomial P ′(x).

∴ With two bands, we have at most M2 + 3 maximal error frequencies.

Page 38: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Maximal Error Locations

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 5 / 11

Maximal error locations occur either at bandedges or when dH

dω= 0

H(ω) = h[0] + 2∑

M2

1 h[n] cosnω= P (cosω)

where P (x) is a polynomial of order M2 . 0 0.5 1 1.5 2 2.5 3

0

0.2

0.4

0.6

0.8

1

1.2

ω

|H|

M=18

dHdω

= −P ′(cosω) sinω

= 0 at ω = 0, π and at most M2 − 1 zeros of polynomial P ′(x).

∴ With two bands, we have at most M2 + 3 maximal error frequencies.

We require M2 + 2 of alternating signs for the optimal fit.

Page 39: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Maximal Error Locations

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 5 / 11

Maximal error locations occur either at bandedges or when dH

dω= 0

H(ω) = h[0] + 2∑

M2

1 h[n] cosnω= P (cosω)

where P (x) is a polynomial of order M2 . 0 0.5 1 1.5 2 2.5 3

0

0.2

0.4

0.6

0.8

1

1.2

ω

|H|

M=18

dHdω

= −P ′(cosω) sinω

= 0 at ω = 0, π and at most M2 − 1 zeros of polynomial P ′(x).

∴ With two bands, we have at most M2 + 3 maximal error frequencies.

We require M2 + 2 of alternating signs for the optimal fit.

Only three possibilities exist (try them all):

(a) ω = 0 + two band edges + all(

M2 − 1

)

zeros of P ′(x).

(b) ω = π + two band edges + all(

M2 − 1

)

zeros of P ′(x).

Page 40: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Maximal Error Locations

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 5 / 11

Maximal error locations occur either at bandedges or when dH

dω= 0

H(ω) = h[0] + 2∑

M2

1 h[n] cosnω= P (cosω)

where P (x) is a polynomial of order M2 . 0 0.5 1 1.5 2 2.5 3

0

0.2

0.4

0.6

0.8

1

1.2

ω

|H|

M=18

dHdω

= −P ′(cosω) sinω

= 0 at ω = 0, π and at most M2 − 1 zeros of polynomial P ′(x).

∴ With two bands, we have at most M2 + 3 maximal error frequencies.

We require M2 + 2 of alternating signs for the optimal fit.

Only three possibilities exist (try them all):

(a) ω = 0 + two band edges + all(

M2 − 1

)

zeros of P ′(x).

(b) ω = π + two band edges + all(

M2 − 1

)

zeros of P ′(x).

(c) ω = 0 and π + two band edges +(

M2 − 2

)

zeros of P ′(x).

Page 41: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Remez Exchange Algorithm

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 6 / 11

1. Guess the positions of the M2 + 2 maximal error frequencies and give

alternating signs to the errors (e.g. choose evenly spaced ω).

Page 42: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Remez Exchange Algorithm

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 6 / 11

1. Guess the positions of the M2 + 2 maximal error frequencies and give

alternating signs to the errors (e.g. choose evenly spaced ω).

2. Determine the error magnitude, ǫ, and the M2 + 1 coefficients of

the polynomial that passes through the maximal error locations.

Page 43: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Remez Exchange Algorithm

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 6 / 11

1. Guess the positions of the M2 + 2 maximal error frequencies and give

alternating signs to the errors (e.g. choose evenly spaced ω).

2. Determine the error magnitude, ǫ, and the M2 + 1 coefficients of

the polynomial that passes through the maximal error locations.

3. Find the local maxima of the error function by evaluatinge(ω) = s(ω)

(

H(ω)− d(ω))

on a dense set of ω.

Page 44: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Remez Exchange Algorithm

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 6 / 11

1. Guess the positions of the M2 + 2 maximal error frequencies and give

alternating signs to the errors (e.g. choose evenly spaced ω).

2. Determine the error magnitude, ǫ, and the M2 + 1 coefficients of

the polynomial that passes through the maximal error locations.

3. Find the local maxima of the error function by evaluatinge(ω) = s(ω)

(

H(ω)− d(ω))

on a dense set of ω.

4. Update the maximal error frequencies to be an alternating subset ofthe local maxima + band edges + 0 and/or π.

Page 45: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Remez Exchange Algorithm

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 6 / 11

1. Guess the positions of the M2 + 2 maximal error frequencies and give

alternating signs to the errors (e.g. choose evenly spaced ω).

2. Determine the error magnitude, ǫ, and the M2 + 1 coefficients of

the polynomial that passes through the maximal error locations.

3. Find the local maxima of the error function by evaluatinge(ω) = s(ω)

(

H(ω)− d(ω))

on a dense set of ω.

4. Update the maximal error frequencies to be an alternating subset ofthe local maxima + band edges + 0 and/or π.

If maximum error is > ǫ, go back to step 2.

Page 46: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Remez Exchange Algorithm

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 6 / 11

1. Guess the positions of the M2 + 2 maximal error frequencies and give

alternating signs to the errors (e.g. choose evenly spaced ω).

2. Determine the error magnitude, ǫ, and the M2 + 1 coefficients of

the polynomial that passes through the maximal error locations.

3. Find the local maxima of the error function by evaluatinge(ω) = s(ω)

(

H(ω)− d(ω))

on a dense set of ω.

4. Update the maximal error frequencies to be an alternating subset ofthe local maxima + band edges + 0 and/or π.

If maximum error is > ǫ, go back to step 2.

Page 47: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Remez Exchange Algorithm

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 6 / 11

1. Guess the positions of the M2 + 2 maximal error frequencies and give

alternating signs to the errors (e.g. choose evenly spaced ω).

2. Determine the error magnitude, ǫ, and the M2 + 1 coefficients of

the polynomial that passes through the maximal error locations.

3. Find the local maxima of the error function by evaluatinge(ω) = s(ω)

(

H(ω)− d(ω))

on a dense set of ω.

4. Update the maximal error frequencies to be an alternating subset ofthe local maxima + band edges + 0 and/or π.

If maximum error is > ǫ, go back to step 2. (typically 15 iterations)

Page 48: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Remez Exchange Algorithm

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 6 / 11

1. Guess the positions of the M2 + 2 maximal error frequencies and give

alternating signs to the errors (e.g. choose evenly spaced ω).

2. Determine the error magnitude, ǫ, and the M2 + 1 coefficients of

the polynomial that passes through the maximal error locations.

3. Find the local maxima of the error function by evaluatinge(ω) = s(ω)

(

H(ω)− d(ω))

on a dense set of ω.

4. Update the maximal error frequencies to be an alternating subset ofthe local maxima + band edges + 0 and/or π.

If maximum error is > ǫ, go back to step 2. (typically 15 iterations)

Page 49: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Remez Exchange Algorithm

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 6 / 11

1. Guess the positions of the M2 + 2 maximal error frequencies and give

alternating signs to the errors (e.g. choose evenly spaced ω).

2. Determine the error magnitude, ǫ, and the M2 + 1 coefficients of

the polynomial that passes through the maximal error locations.

3. Find the local maxima of the error function by evaluatinge(ω) = s(ω)

(

H(ω)− d(ω))

on a dense set of ω.

4. Update the maximal error frequencies to be an alternating subset ofthe local maxima + band edges + 0 and/or π.

If maximum error is > ǫ, go back to step 2. (typically 15 iterations)

Page 50: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Remez Exchange Algorithm

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 6 / 11

1. Guess the positions of the M2 + 2 maximal error frequencies and give

alternating signs to the errors (e.g. choose evenly spaced ω).

2. Determine the error magnitude, ǫ, and the M2 + 1 coefficients of

the polynomial that passes through the maximal error locations.

3. Find the local maxima of the error function by evaluatinge(ω) = s(ω)

(

H(ω)− d(ω))

on a dense set of ω.

4. Update the maximal error frequencies to be an alternating subset ofthe local maxima + band edges + 0 and/or π.

If maximum error is > ǫ, go back to step 2. (typically 15 iterations)

5. Evaluate H(ω) on M + 1 evenly spaced ω and do an IDFT to get h[n].

Page 51: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Remex Step 2: Determine Polynomial

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 7 / 11

For each extremal frequency, ωi for 1 ≤ i ≤ M2 + 2

d(ωi) = H(ωi) +(−1)iǫs(ωi)

Page 52: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Remex Step 2: Determine Polynomial

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 7 / 11

For each extremal frequency, ωi for 1 ≤ i ≤ M2 + 2

d(ωi) = H(ωi) +(−1)iǫs(ωi)

= h[0] + 2∑

M2

n=1 h[n] cosnωi +(−1)iǫs(ωi)

Page 53: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Remex Step 2: Determine Polynomial

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 7 / 11

For each extremal frequency, ωi for 1 ≤ i ≤ M2 + 2

d(ωi) = H(ωi) +(−1)iǫs(ωi)

= h[0] + 2∑

M2

n=1 h[n] cosnωi +(−1)iǫs(ωi)

Method 1:Solve M

2 + 2 equations in M2 + 2 unknowns for h[n] + ǫ.

Page 54: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Remex Step 2: Determine Polynomial

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 7 / 11

For each extremal frequency, ωi for 1 ≤ i ≤ M2 + 2

d(ωi) = H(ωi) +(−1)iǫs(ωi)

= h[0] + 2∑

M2

n=1 h[n] cosnωi +(−1)iǫs(ωi)

Method 1:Solve M

2 + 2 equations in M2 + 2 unknowns for h[n] + ǫ.

In step 3, evaluate H(ω) = h[0] + 2∑

M2

n=1 h[n] cosnωi

Page 55: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Remex Step 2: Determine Polynomial

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 7 / 11

For each extremal frequency, ωi for 1 ≤ i ≤ M2 + 2

d(ωi) = H(ωi) +(−1)iǫs(ωi)

= h[0] + 2∑

M2

n=1 h[n] cosnωi +(−1)iǫs(ωi)

Method 1: (Computation time ∝ M3)Solve M

2 + 2 equations in M2 + 2 unknowns for h[n] + ǫ.

In step 3, evaluate H(ω) = h[0] + 2∑

M2

n=1 h[n] cosnωi

Page 56: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Remex Step 2: Determine Polynomial

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 7 / 11

For each extremal frequency, ωi for 1 ≤ i ≤ M2 + 2

d(ωi) = H(ωi) +(−1)iǫs(ωi)

= h[0] + 2∑

M2

n=1 h[n] cosnωi +(−1)iǫs(ωi)

Method 1: (Computation time ∝ M3)Solve M

2 + 2 equations in M2 + 2 unknowns for h[n] + ǫ.

In step 3, evaluate H(ω) = h[0] + 2∑

M2

n=1 h[n] cosnωi

Method 2: Don’t calculate h[n] explicitlyMultiply the ωi equation by ci =

j 6=i1

cosωi−cosωjand add them:

M2+2

i=1 ci

(

h[0] + 2∑

M2

n=1 h[n] cosnω + (−1)iǫs(ωi)

)

=∑

M2+2

i=1 cid(ωi)

Page 57: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Remex Step 2: Determine Polynomial

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 7 / 11

For each extremal frequency, ωi for 1 ≤ i ≤ M2 + 2

d(ωi) = H(ωi) +(−1)iǫs(ωi)

= h[0] + 2∑

M2

n=1 h[n] cosnωi +(−1)iǫs(ωi)

Method 1: (Computation time ∝ M3)Solve M

2 + 2 equations in M2 + 2 unknowns for h[n] + ǫ.

In step 3, evaluate H(ω) = h[0] + 2∑

M2

n=1 h[n] cosnωi

Method 2: Don’t calculate h[n] explicitlyMultiply the ωi equation by ci =

j 6=i1

cosωi−cosωjand add them:

M2+2

i=1 ci

(

h[0] + 2∑

M2

n=1 h[n] cosnω + (−1)iǫs(ωi)

)

=∑

M2+2

i=1 cid(ωi)

All terms involving h[n] sum to zero leaving∑

M2+2

i=1(−1)icis(ωi)

ǫ =∑

M2+2

i=1 cid(ωi)

Page 58: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Remex Step 2: Determine Polynomial

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 7 / 11

For each extremal frequency, ωi for 1 ≤ i ≤ M2 + 2

d(ωi) = H(ωi) +(−1)iǫs(ωi)

= h[0] + 2∑

M2

n=1 h[n] cosnωi +(−1)iǫs(ωi)

Method 1: (Computation time ∝ M3)Solve M

2 + 2 equations in M2 + 2 unknowns for h[n] + ǫ.

In step 3, evaluate H(ω) = h[0] + 2∑

M2

n=1 h[n] cosnωi

Method 2: Don’t calculate h[n] explicitlyMultiply the ωi equation by ci =

j 6=i1

cosωi−cosωjand add them:

M2+2

i=1 ci

(

h[0] + 2∑

M2

n=1 h[n] cosnω + (−1)iǫs(ωi)

)

=∑

M2+2

i=1 cid(ωi)

All terms involving h[n] sum to zero leaving∑

M2+2

i=1(−1)icis(ωi)

ǫ =∑

M2+2

i=1 cid(ωi)

Solve for ǫ

Page 59: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Remex Step 2: Determine Polynomial

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 7 / 11

For each extremal frequency, ωi for 1 ≤ i ≤ M2 + 2

d(ωi) = H(ωi) +(−1)iǫs(ωi)

= h[0] + 2∑

M2

n=1 h[n] cosnωi +(−1)iǫs(ωi)

Method 1: (Computation time ∝ M3)Solve M

2 + 2 equations in M2 + 2 unknowns for h[n] + ǫ.

In step 3, evaluate H(ω) = h[0] + 2∑

M2

n=1 h[n] cosnωi

Method 2: Don’t calculate h[n] explicitlyMultiply the ωi equation by ci =

j 6=i1

cosωi−cosωjand add them:

M2+2

i=1 ci

(

h[0] + 2∑

M2

n=1 h[n] cosnω + (−1)iǫs(ωi)

)

=∑

M2+2

i=1 cid(ωi)

All terms involving h[n] sum to zero leaving∑

M2+2

i=1(−1)icis(ωi)

ǫ =∑

M2+2

i=1 cid(ωi)

Solve for ǫ then calculate the H(ωi)

Page 60: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Remex Step 2: Determine Polynomial

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 7 / 11

For each extremal frequency, ωi for 1 ≤ i ≤ M2 + 2

d(ωi) = H(ωi) +(−1)iǫs(ωi)

= h[0] + 2∑

M2

n=1 h[n] cosnωi +(−1)iǫs(ωi)

Method 1: (Computation time ∝ M3)Solve M

2 + 2 equations in M2 + 2 unknowns for h[n] + ǫ.

In step 3, evaluate H(ω) = h[0] + 2∑

M2

n=1 h[n] cosnωi

Method 2: Don’t calculate h[n] explicitlyMultiply the ωi equation by ci =

j 6=i1

cosωi−cosωjand add them:

M2+2

i=1 ci

(

h[0] + 2∑

M2

n=1 h[n] cosnω + (−1)iǫs(ωi)

)

=∑

M2+2

i=1 cid(ωi)

All terms involving h[n] sum to zero leaving∑

M2+2

i=1(−1)icis(ωi)

ǫ =∑

M2+2

i=1 cid(ωi)

Solve for ǫ then calculate the H(ωi) then use Lagrange interpolation:

H(ω) = P (cosω) =∑

M2+2

i=1 H(ωi)∏

j 6=i

cosω−cosωj

cosωi−cosωj

Page 61: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Remex Step 2: Determine Polynomial

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 7 / 11

For each extremal frequency, ωi for 1 ≤ i ≤ M2 + 2

d(ωi) = H(ωi) +(−1)iǫs(ωi)

= h[0] + 2∑

M2

n=1 h[n] cosnωi +(−1)iǫs(ωi)

Method 1: (Computation time ∝ M3)Solve M

2 + 2 equations in M2 + 2 unknowns for h[n] + ǫ.

In step 3, evaluate H(ω) = h[0] + 2∑

M2

n=1 h[n] cosnωi

Method 2: Don’t calculate h[n] explicitlyMultiply the ωi equation by ci =

j 6=i1

cosωi−cosωjand add them:

M2+2

i=1 ci

(

h[0] + 2∑

M2

n=1 h[n] cosnω + (−1)iǫs(ωi)

)

=∑

M2+2

i=1 cid(ωi)

All terms involving h[n] sum to zero leaving∑

M2+2

i=1(−1)icis(ωi)

ǫ =∑

M2+2

i=1 cid(ωi)

Solve for ǫ then calculate the H(ωi) then use Lagrange interpolation:

H(ω) = P (cosω) =∑

M2+2

i=1 H(ωi)∏

j 6=i

cosω−cosωj

cosωi−cosωj(

M2 + 1

)

-polynomial going through all the H(ωi) [actually order M2 ]

Page 62: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Remex Step 2: Determine Polynomial

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 7 / 11

For each extremal frequency, ωi for 1 ≤ i ≤ M2 + 2

d(ωi) = H(ωi) +(−1)iǫs(ωi)

= h[0] + 2∑

M2

n=1 h[n] cosnωi +(−1)iǫs(ωi)

Method 1: (Computation time ∝ M3)Solve M

2 + 2 equations in M2 + 2 unknowns for h[n] + ǫ.

In step 3, evaluate H(ω) = h[0] + 2∑

M2

n=1 h[n] cosnωi

Method 2: Don’t calculate h[n] explicitly (Computation time ∝ M2)Multiply the ωi equation by ci =

j 6=i1

cosωi−cosωjand add them:

M2+2

i=1 ci

(

h[0] + 2∑

M2

n=1 h[n] cosnω + (−1)iǫs(ωi)

)

=∑

M2+2

i=1 cid(ωi)

All terms involving h[n] sum to zero leaving∑

M2+2

i=1(−1)icis(ωi)

ǫ =∑

M2+2

i=1 cid(ωi)

Solve for ǫ then calculate the H(ωi) then use Lagrange interpolation:

H(ω) = P (cosω) =∑

M2+2

i=1 H(ωi)∏

j 6=i

cosω−cosωj

cosωi−cosωj(

M2 + 1

)

-polynomial going through all the H(ωi) [actually order M2 ]

Page 63: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Example Design

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 8 / 11

Filter Specifications:Bandpass ω = [0.5, 1],

0 0.5 1 1.5 2 2.5 30

0.2

0.4

0.6

0.8

1

ω

|H|

M=36

Page 64: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Example Design

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 8 / 11

Filter Specifications:Bandpass ω = [0.5, 1], Transition widths: ∆ω = 0.2

0 0.5 1 1.5 2 2.5 30

0.2

0.4

0.6

0.8

1

ω

|H|

M=36

Page 65: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Example Design

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 8 / 11

Filter Specifications:Bandpass ω = [0.5, 1], Transition widths: ∆ω = 0.2Stopband Attenuation: −25 dB and −15 dB

0 0.5 1 1.5 2 2.5 30

0.2

0.4

0.6

0.8

1

ω

|H|

M=36

Page 66: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Example Design

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 8 / 11

Filter Specifications:Bandpass ω = [0.5, 1], Transition widths: ∆ω = 0.2Stopband Attenuation: −25 dB and −15 dBPassband Ripple: ±0.3 dB

0 0.5 1 1.5 2 2.5 30

0.2

0.4

0.6

0.8

1

ω

|H|

M=36

Page 67: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Example Design

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 8 / 11

Filter Specifications:Bandpass ω = [0.5, 1], Transition widths: ∆ω = 0.2Stopband Attenuation: −25 dB and −15 dBPassband Ripple: ±0.3 dB

Determine gain tolerances for each band:−25 dB = 0.056, −0.3 dB = 1− 0.034, −15 dB = 0.178

0 0.5 1 1.5 2 2.5 30

0.2

0.4

0.6

0.8

1

ω

|H|

M=36

Page 68: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Example Design

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 8 / 11

Filter Specifications:Bandpass ω = [0.5, 1], Transition widths: ∆ω = 0.2Stopband Attenuation: −25 dB and −15 dBPassband Ripple: ±0.3 dB

Determine gain tolerances for each band:−25 dB = 0.056, −0.3 dB = 1− 0.034, −15 dB = 0.178

Predicted order: M = 36

0 0.5 1 1.5 2 2.5 30

0.2

0.4

0.6

0.8

1

ω

|H|

M=36

Page 69: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Example Design

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 8 / 11

Filter Specifications:Bandpass ω = [0.5, 1], Transition widths: ∆ω = 0.2Stopband Attenuation: −25 dB and −15 dBPassband Ripple: ±0.3 dB

Determine gain tolerances for each band:−25 dB = 0.056, −0.3 dB = 1− 0.034, −15 dB = 0.178

Predicted order: M = 36M2 + 2 extremal frequencies are distributed between the bands

0 0.5 1 1.5 2 2.5 30

0.2

0.4

0.6

0.8

1

ω

|H|

M=36

Page 70: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Example Design

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 8 / 11

Filter Specifications:Bandpass ω = [0.5, 1], Transition widths: ∆ω = 0.2Stopband Attenuation: −25 dB and −15 dBPassband Ripple: ±0.3 dB

Determine gain tolerances for each band:−25 dB = 0.056, −0.3 dB = 1− 0.034, −15 dB = 0.178

Predicted order: M = 36M2 + 2 extremal frequencies are distributed between the bands

Filter meets specs ,

0 0.5 1 1.5 2 2.5 30

0.2

0.4

0.6

0.8

1

ω

|H|

M=36

Page 71: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Example Design

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 8 / 11

Filter Specifications:Bandpass ω = [0.5, 1], Transition widths: ∆ω = 0.2Stopband Attenuation: −25 dB and −15 dBPassband Ripple: ±0.3 dB

Determine gain tolerances for each band:−25 dB = 0.056, −0.3 dB = 1− 0.034, −15 dB = 0.178

Predicted order: M = 36M2 + 2 extremal frequencies are distributed between the bands

Filter meets specs ,; clearer on a decibel scale

0 0.5 1 1.5 2 2.5 30

0.2

0.4

0.6

0.8

1

ω

|H|

M=36

0 0.5 1 1.5 2 2.5 3-30

-25

-20

-15

-10

-5

0

ω

|H| (

dB)

M=36

Page 72: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Example Design

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 8 / 11

Filter Specifications:Bandpass ω = [0.5, 1], Transition widths: ∆ω = 0.2Stopband Attenuation: −25 dB and −15 dBPassband Ripple: ±0.3 dB

Determine gain tolerances for each band:−25 dB = 0.056, −0.3 dB = 1− 0.034, −15 dB = 0.178

Predicted order: M = 36M2 + 2 extremal frequencies are distributed between the bands

Filter meets specs ,; clearer on a decibel scaleMost zeros are on the unit circle + three reciprocal pairs

0 0.5 1 1.5 2 2.5 30

0.2

0.4

0.6

0.8

1

ω

|H|

M=36

0 0.5 1 1.5 2 2.5 3-30

-25

-20

-15

-10

-5

0

ω

|H| (

dB)

M=36

-1 0 1 2

-1

-0.5

0

0.5

1

Page 73: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Example Design

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 8 / 11

Filter Specifications:Bandpass ω = [0.5, 1], Transition widths: ∆ω = 0.2Stopband Attenuation: −25 dB and −15 dBPassband Ripple: ±0.3 dB

Determine gain tolerances for each band:−25 dB = 0.056, −0.3 dB = 1− 0.034, −15 dB = 0.178

Predicted order: M = 36M2 + 2 extremal frequencies are distributed between the bands

Filter meets specs ,; clearer on a decibel scaleMost zeros are on the unit circle + three reciprocal pairs

Reciprocal pairs give a linear phase shift

0 0.5 1 1.5 2 2.5 30

0.2

0.4

0.6

0.8

1

ω

|H|

M=36

0 0.5 1 1.5 2 2.5 3-30

-25

-20

-15

-10

-5

0

ω

|H| (

dB)

M=36

-1 0 1 2

-1

-0.5

0

0.5

1

Page 74: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

FIR Pros and Cons

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 9 / 11

• Can have linear phase no envelope distortion, all frequencies have the same delay ,

symmetric or antisymmetric: h[n] = h[−n]∀n or −h[−n]∀n antisymmetric filters have H(ej0) = H(ejπ) = 0 symmetry means you only need M

2 + 1 multiplicationsto implement the filter.

Page 75: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

FIR Pros and Cons

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 9 / 11

• Can have linear phase no envelope distortion, all frequencies have the same delay ,

symmetric or antisymmetric: h[n] = h[−n]∀n or −h[−n]∀n antisymmetric filters have H(ej0) = H(ejπ) = 0 symmetry means you only need M

2 + 1 multiplicationsto implement the filter.

• Always stable ,

Page 76: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

FIR Pros and Cons

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 9 / 11

• Can have linear phase no envelope distortion, all frequencies have the same delay ,

symmetric or antisymmetric: h[n] = h[−n]∀n or −h[−n]∀n antisymmetric filters have H(ej0) = H(ejπ) = 0 symmetry means you only need M

2 + 1 multiplicationsto implement the filter.

• Always stable ,

• Low coefficient sensitivity ,

Page 77: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

FIR Pros and Cons

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 9 / 11

• Can have linear phase no envelope distortion, all frequencies have the same delay ,

symmetric or antisymmetric: h[n] = h[−n]∀n or −h[−n]∀n antisymmetric filters have H(ej0) = H(ejπ) = 0 symmetry means you only need M

2 + 1 multiplicationsto implement the filter.

• Always stable ,

• Low coefficient sensitivity ,

• Optimal design method fast and robust ,

Page 78: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

FIR Pros and Cons

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 9 / 11

• Can have linear phase no envelope distortion, all frequencies have the same delay ,

symmetric or antisymmetric: h[n] = h[−n]∀n or −h[−n]∀n antisymmetric filters have H(ej0) = H(ejπ) = 0 symmetry means you only need M

2 + 1 multiplicationsto implement the filter.

• Always stable ,

• Low coefficient sensitivity ,

• Optimal design method fast and robust ,

• Normally needs higher order than an IIR filter /

Filter order M ≈ dBatten

3.5∆ωwhere ∆ω is the most rapid transition

Page 79: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

FIR Pros and Cons

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 9 / 11

• Can have linear phase no envelope distortion, all frequencies have the same delay ,

symmetric or antisymmetric: h[n] = h[−n]∀n or −h[−n]∀n antisymmetric filters have H(ej0) = H(ejπ) = 0 symmetry means you only need M

2 + 1 multiplicationsto implement the filter.

• Always stable ,

• Low coefficient sensitivity ,

• Optimal design method fast and robust ,

• Normally needs higher order than an IIR filter /

Filter order M ≈ dBatten

3.5∆ωwhere ∆ω is the most rapid transition

Filtering complexity ∝ M × fs ≈dBatten

3.5∆ωfs =

dBatten

3.5∆Ω f2s

∝ f2s for a given specification in unscaled Ω units.

Page 80: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Summary

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 10 / 11

Optimal Filters: minimax error criterion

Page 81: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Summary

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 10 / 11

Optimal Filters: minimax error criterion

• use weight function, s(ω), to allow different errorsin different frequency bands

Page 82: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Summary

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 10 / 11

Optimal Filters: minimax error criterion

• use weight function, s(ω), to allow different errorsin different frequency bands

• symmetric filter has zeros on unit circle or in reciprocal pairs

Page 83: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Summary

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 10 / 11

Optimal Filters: minimax error criterion

• use weight function, s(ω), to allow different errorsin different frequency bands

• symmetric filter has zeros on unit circle or in reciprocal pairs• Response of symmetric filter is a polynomial in cosω

Page 84: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Summary

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 10 / 11

Optimal Filters: minimax error criterion

• use weight function, s(ω), to allow different errorsin different frequency bands

• symmetric filter has zeros on unit circle or in reciprocal pairs• Response of symmetric filter is a polynomial in cosω• Alternation Theorem: M

2 + 2 maximal errors with alternating signs

Page 85: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Summary

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 10 / 11

Optimal Filters: minimax error criterion

• use weight function, s(ω), to allow different errorsin different frequency bands

• symmetric filter has zeros on unit circle or in reciprocal pairs• Response of symmetric filter is a polynomial in cosω• Alternation Theorem: M

2 + 2 maximal errors with alternating signs

Remez Exchange Algorithm (also known as Parks-McLellan Algorithm)

Page 86: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Summary

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 10 / 11

Optimal Filters: minimax error criterion

• use weight function, s(ω), to allow different errorsin different frequency bands

• symmetric filter has zeros on unit circle or in reciprocal pairs• Response of symmetric filter is a polynomial in cosω• Alternation Theorem: M

2 + 2 maximal errors with alternating signs

Remez Exchange Algorithm (also known as Parks-McLellan Algorithm)

• multiple constant-gain bands separated by transition regions

Page 87: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Summary

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 10 / 11

Optimal Filters: minimax error criterion

• use weight function, s(ω), to allow different errorsin different frequency bands

• symmetric filter has zeros on unit circle or in reciprocal pairs• Response of symmetric filter is a polynomial in cosω• Alternation Theorem: M

2 + 2 maximal errors with alternating signs

Remez Exchange Algorithm (also known as Parks-McLellan Algorithm)

• multiple constant-gain bands separated by transition regions• very robust, works for filters with M > 1000

Page 88: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Summary

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 10 / 11

Optimal Filters: minimax error criterion

• use weight function, s(ω), to allow different errorsin different frequency bands

• symmetric filter has zeros on unit circle or in reciprocal pairs• Response of symmetric filter is a polynomial in cosω• Alternation Theorem: M

2 + 2 maximal errors with alternating signs

Remez Exchange Algorithm (also known as Parks-McLellan Algorithm)

• multiple constant-gain bands separated by transition regions• very robust, works for filters with M > 1000• Efficient: computation ∝ M2

Page 89: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Summary

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 10 / 11

Optimal Filters: minimax error criterion

• use weight function, s(ω), to allow different errorsin different frequency bands

• symmetric filter has zeros on unit circle or in reciprocal pairs• Response of symmetric filter is a polynomial in cosω• Alternation Theorem: M

2 + 2 maximal errors with alternating signs

Remez Exchange Algorithm (also known as Parks-McLellan Algorithm)

• multiple constant-gain bands separated by transition regions• very robust, works for filters with M > 1000• Efficient: computation ∝ M2

• can go mad in the transition regions

Page 90: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Summary

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 10 / 11

Optimal Filters: minimax error criterion

• use weight function, s(ω), to allow different errorsin different frequency bands

• symmetric filter has zeros on unit circle or in reciprocal pairs• Response of symmetric filter is a polynomial in cosω• Alternation Theorem: M

2 + 2 maximal errors with alternating signs

Remez Exchange Algorithm (also known as Parks-McLellan Algorithm)

• multiple constant-gain bands separated by transition regions• very robust, works for filters with M > 1000• Efficient: computation ∝ M2

• can go mad in the transition regions

Modified version works on arbitrary gain function

Page 91: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Summary

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 10 / 11

Optimal Filters: minimax error criterion

• use weight function, s(ω), to allow different errorsin different frequency bands

• symmetric filter has zeros on unit circle or in reciprocal pairs• Response of symmetric filter is a polynomial in cosω• Alternation Theorem: M

2 + 2 maximal errors with alternating signs

Remez Exchange Algorithm (also known as Parks-McLellan Algorithm)

• multiple constant-gain bands separated by transition regions• very robust, works for filters with M > 1000• Efficient: computation ∝ M2

• can go mad in the transition regions

Modified version works on arbitrary gain function

• Does not always converge

Page 92: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

Summary

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 10 / 11

Optimal Filters: minimax error criterion

• use weight function, s(ω), to allow different errorsin different frequency bands

• symmetric filter has zeros on unit circle or in reciprocal pairs• Response of symmetric filter is a polynomial in cosω• Alternation Theorem: M

2 + 2 maximal errors with alternating signs

Remez Exchange Algorithm (also known as Parks-McLellan Algorithm)

• multiple constant-gain bands separated by transition regions• very robust, works for filters with M > 1000• Efficient: computation ∝ M2

• can go mad in the transition regions

Modified version works on arbitrary gain function

• Does not always converge

For further details see Mitra: 10.

Page 93: 7: Optimal FIR filtersAlternation Theorem 7: Optimal FIR filters •Optimal Filters •Alternation Theorem •Chebyshev Polynomials •Maximal Error Locations •Remez Exchange Algorithm

MATLAB routines

7: Optimal FIR filters

• Optimal Filters

• Alternation Theorem

• Chebyshev Polynomials

• Maximal Error Locations• Remez ExchangeAlgorithm

• Determine Polynomial

• Example Design

• FIR Pros and Cons

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10122) Optimal FIR: 7 – 11 / 11

firpm optimal FIR filter designfirpmord estimate require order for firpmcfirpm arbitrary-response filter designremez [obsolete] optimal FIR filter design