Page MenuHomec4science

1_fir.tex
No OneTemporary

File Metadata

Created
Thu, Mar 13, 12:59

1_fir.tex

\documentclass[aspectratio=169]{beamer}
\def\stylepath{../styles}
\usepackage{\stylepath/com303}
\begin{document}
\begin{frame} \frametitle{FIR: optimal minimax design}
FIR filters are a digital signal processing ``exclusivity''. \\
In the 1970s Parks and McClellan developed an algorithm to design optimal FIR filters:
\begin{itemize}
\item<2-> linear phase
\item<3-> equiripple error in passband and stopband
\end{itemize}
\vspace{2em}
\uncover<4->{algorithm proceeds by \textbf{mini}mizing the \textbf{max}imum error in passband and stopband}
\end{frame}
\begin{frame} \frametitle{Linear phase in FIRs}
\centering
Symmetric or antisymmetric impulse responses have linear phase
\begin{tabular}{cl}
\begin{dspPlot}[width=5cm,height=2.5cm,xticks=none,yticks=none,ylabel={Type I}]{-2,2}{-2,3}
\moocStyle \dspTaps{-1 1 0 2.2 1 1}
\end{dspPlot}
&
\begin{dspPlot}[width=5cm,height=2.5cm,xticks=none,yticks=none,ylabel={Type II}]{-1.5,2.5}{-2,3}
\moocStyle \dspTaps{0 2 1 2}
\end{dspPlot}
\\
\begin{dspPlot}[width=5cm,height=2.5cm,xticks=none,yticks=none,ylabel={Type III}]{-2,2}{-2,3}
\moocStyle \dspTaps{-1 -1 0 0 1 1}
\end{dspPlot}
&
\begin{dspPlot}[width=5cm,height=2.5cm,xticks=none,yticks=none,ylabel={Type IV}]{-1.5,2.5}{-2,3}
\moocStyle \dspTaps{0 1 1 -1}
\end{dspPlot}
\end{tabular}
\end{frame}
\begin{frame} \frametitle{Linear phase (Type I)}
\centering
filter length is \textbf{odd}: $M = 2L+1$
\[
h[L+n] = h[L-n]
\]
\pause
zero-centered filter:
\begin{align*}
h_d[n] &= h[n+L] \\
h_d[n] &= h_d[-n]
\end{align*}
\end{frame}
\begin{frame} \frametitle{Linear phase (Type I)}
\centering
\only<1>{$h[n]$}\only<2->{$h_d[n]$}
\begin{dspPlot}[xticks=custom,yticks=none]{-5,5}{-3,4}
\moocStyle
\only<1>{%
\dspTapsAt{-5}{0 0 0 0 0 1 -2 3 -2 1 0}
\dspCustomTicks[axis=x]{0 0 2 $L$ 4 $M-1$}}
\only<2->{%
\dspTapsAt{-5}{0 0 0 1 -2 3 -2 1 0 0 0}
\dspCustomTicks[axis=x]{-2 $-L$ 0 0 2 $L$}}
\end{dspPlot}
\end{frame}
\begin{frame} \frametitle{Linear phase (Type I)}
\begin{align*}
H_d(z) &= \sum_{n = -L}^{L} h_d[n] z^{-n} \\ \pause
&= h_d[0] + \sum_{n = 1}^{L} h_d[n] (z^{n}+z^{-n})
\end{align*}
\pause
\begin{align*}
H_d(e^{j\omega}) &= h_d[0] + \sum_{n = 1}^{L} h_d[n] (e^{j\omega n}+e^{-j\omega n}) \\ \pause
&= h_d[0] + 2\sum_{n = 1}^{L} h_d[n] \cos \omega n \quad \in \mathbb{R}
\end{align*}
\end{frame}
\begin{frame} \frametitle{Linear phase (Type I)}
\[
H(z) = z^{-L}H_d(z)
\]
\[
H(e^{j\omega}) = \left[h[L] + 2 \sum_{n=1}^{L}h[n+L]\cos n\omega\right] e^{-j\omega L}
\]
\end{frame}
\def\fex#1#2#3{%
\begin{dspPlot}[width=2cm,height=0.8cm,yticks=none,xticks=none]{#1,#2}{-4,4}%
\moocStyle
\dspTapsAt{#1}{#3}%
\end{dspPlot}}
\begin{frame} \frametitle{Linear Phase FIR Filters}
\begin{itemize}
\item $L$: number of points with a ``companion''
\item even-length FIRs: $M = 2L$ taps
\item odd-length FIRs: $M = 2L+1$ taps
\item delay equal to half-length: $C = (M-1)/2$
\item delay is non-integer for even-length filters!
\end{itemize}
\end{frame}
\begin{frame} \frametitle{FIR types ($L=1$)}
\centering
\begin{tabular}{cc}
\begin{dspPlot}[width=5cm,height=2.5cm,xticks=none,yticks=none,ylabel={Type I}]{-2,2}{-2,3}
\moocStyle \dspTaps{-1 1 0 2.2 1 1}
\end{dspPlot}
&
\begin{dspPlot}[width=5cm,height=2.5cm,xticks=none,yticks=none,ylabel={Type II}]{-1.5,2.5}{-2,3}
\moocStyle \dspTaps{0 2 1 2}
\end{dspPlot}
\\
\begin{dspPlot}[width=5cm,height=2.5cm,xticks=none,yticks=none,ylabel={Type III}]{-2,2}{-2,3}
\moocStyle \dspTaps{-1 -1 0 0 1 1}
\end{dspPlot}
&
\begin{dspPlot}[width=5cm,height=2.5cm,xticks=none,yticks=none,ylabel={Type IV}]{-1.5,2.5}{-2,3}
\moocStyle \dspTaps{0 1 1 -1}
\end{dspPlot}
\\
$M=2L+1 = 3$ & $M=2L = 2$
\end{tabular}
\end{frame}
\begin{frame} \frametitle{Linear phase (Type II)}
\centering
filter length is \textbf{even}: $M = 2L$
\[
h[n] = h[2L-1-n]
\]
\end{frame}
\begin{frame}
\frametitle{Linear phase (Type II)}
\centering
$h[n]$
\begin{dspPlot}[xticks=custom,yticks=none]{-5,5}{-3,4}
\moocStyle
\dspTapsAt{-5}{0 0 0 0 0 3 -2 -2 3 0 0}
\dspCustomTicks[axis=x]{0 0 1 $L-1$ 2 $L$ 3 $M-1$}
\end{dspPlot}
\end{frame}
\begin{frame}
\frametitle{Linear phase (Type II)}
\begin{align*}
H(z) = & h[0] &+& h[1]z^{-1} &+& \ldots &+& h[L-1]z^{-L+1} + \\
& h[2L-1]z^{-2L+1} &+& h[2L-2]z^{-2L+2} &+& \ldots &+& h[L]z^{-L} \\ \pause
= & h[0] &+& h[1]z^{-1} &+& \ldots &+& h[L-1]z^{-L+1} + \\
& h[0]z^{-2L+1} &+& h[1]z^{-2L+2} &+& \ldots &+& h[L-1]z^{-L} \\ \pause
=& \sum_{n=0}^{L-1} h[n] (z^{-n}+z^{-2L+1+n})
\end{align*}
\end{frame}
\begin{frame}
\frametitle{Linear phase (Type II)}
\[
C = (M-1)/2 = (2L-1)/2 = L - 1/2 \quad \mbox{(non-integer!)}
\]
\begin{align*}
H(z) &= \sum_{n=0}^{L-1} h[n] (z^{-n}+z^{-2C+n}) \\ \pause
&= z^{-C}\sum_{n=0}^{L-1} h[n] (z^{(C-n)}+z^{-(C-n)})
\end{align*}
\end{frame}
\begin{frame}
\frametitle{Linear phase (Type II)}
\[
H(e^{j\omega}) = \left[2 \sum_{n=0}^{L-1}h[n]\cos(\omega(C-n)) \right] e^{-j\omega C}
\]
\vspace{2em}
\[
C = L - \frac{1}{2}
\]
\end{frame}
\begin{frame}
\frametitle{Linear Phase FIR Filters}
\begin{center}
\begin{tabular}{|c|c|c|c|c|c|c|}
\hline
\bf type & \bf length & \bf sym. & \bf delay & \bf zeros & \\ \hline\hline
I & odd & S & integer & & \fex{-2}{2}{2 -3 3 -3 2} \\ \hline
II & even & S & non-int. & & \fex{0}{3}{-2 3 3 -2} \\ \hline
III & odd & A & integer & & \fex{-2}{2}{2 -3 0 3 -2} \\ \hline
IV & even & A & non-int. & & \fex{-1}{2}{2 -3 3 -2} \\ \hline
\end{tabular}
\end{center}
\end{frame}
\begin{frame}
\frametitle{Zero locations (all types)}
\begin{itemize}
\item FIRs have only zeros
\item $h[n] \in \mathbb{R} \Rightarrow$ if $z_0$ is a zero, so is $z_0^*$
\end{itemize}
\end{frame}
\begin{frame} \frametitle{Zero locations (Type I)}
\begin{align*}
H(z) &= z^{-L}\left[ h[0] + \sum_n h_d[n] (z^{n}+z^{-n})\right] \\ \pause
H(z^{-1}) &= z^{L}\left[ h[0] + \sum_n h_d[n] (z^{n}+z^{-n})\right] \\ \pause
H(z^{-1}) &= z^{2L}H(z)
\end{align*}
\centering
\vspace{1em}
if $z_0$ is a zero, so is $1/z_0$
\end{frame}
\begin{frame} \frametitle{Zero locations}
\centering
\vspace{1em}
if $z_0$ is a zero, so is $1/z_0$
\vspace{3em}
\pause
this is valid for all FIR types (easy to prove)
\end{frame}
\begin{frame} \frametitle{Zero locations (all types)}
\begin{itemize}
\item if $z_0$ is a zero, so is $z_0^*$
\item if $z_0$ is a zero, so is $1/z_0$
\item if $z_0 = \rho e^{j\theta}$ is a zero so are:
\begin{itemize}
\item $\rho e^{j\theta}$
\item $(1/\rho) e^{j\theta}$
\item $\rho e^{-j\theta}$
\item $(1/\rho) e^{-j\theta}$
\end{itemize}
\end{itemize}
\end{frame}
\begin{frame} \frametitle{Typical zero plot for linear-phase FIR}
\begin{figure}
\center
\begin{dspPZPlot}[width=6cm,clabel={$1$}]{2.5}
\moocStyle
\only<1->{
\dspPZ[type=zero,label=none]{-0.9581, 0.2864}}
\only<2->{
\dspPZ[type=zero,label=none]{-0.9581, -0.2864}}
\only<3->{
\dspPZ[type=zero,label=none,linecolor=red!50]{-0.6424, 0.7664}
\dspPZ[type=zero,label=none,linecolor=red!50]{-0.6424, -0.7664}
\dspPZ[type=zero,label=none,linecolor=red!30]{-0.1394, 0.9902}
\dspPZ[type=zero,label=none,linecolor=red!30]{-0.1394, -0.9902}}
\only<4->{
\dspPZ[type=zero,label=none,linecolor=darkgreen]{ 0.4319, 0}}
\only<5->{
\dspPZ[type=zero,label=none,linecolor=darkgreen]{2.3152, 0}}
\only<6->{
\dspPZ[type=zero,label=none,linecolor=blue!60]{1.3357, 1.3008}}
\only<7->{
\dspPZ[type=zero,label=none,linecolor=blue!60]{1.3357, -1.3008}
\dspPZ[type=zero,label=none,linecolor=blue!60]{ 0.3842, 0.3742}
\dspPZ[type=zero,label=none,linecolor=blue!60]{ 0.3842, -0.3742}}
\end{dspPZPlot}
\end{figure}
\end{frame}
\begin{frame}
\frametitle{Zero locations (Type II)}
\begin{align*}
H(z) &= z^{-C} \sum_{n=0}^{L-1} h[n] (z^{(C-n)}+z^{-(C-n)}) \\ \pause
H(z^{-1}) &= z^{C} \sum_{n=0}^{L-1} h[n] (z^{(C-n)}+z^{-(C-n)}) \\ \\ \pause
H(z^{-1}) &= z^{2C}H(z)
\end{align*}
\end{frame}
\begin{frame}
\frametitle{Zero locations (Type II)}
\begin{align*}
C &= L-1/2 \\ \pause
H(z^{-1}) &= z^{2C}H(z) \\
&= z^{2L-1}H(z) \\ \\ \pause
H(-1) &= (-1)^{2L-1}H(-1) = -H(-1) \\ \pause
H(-1) &= 0
\end{align*}
\end{frame}
\begin{frame}
\frametitle{Zero locations (Type II)}
\centering
type-II FIRs always have a zero at $\omega = \pi$
\end{frame}
\begin{frame}
\frametitle{Zero locations (Type III)}
\begin{align*}
H(z) &= z^{-L}\left[ \sum_n h_d[n] (z^{n}-z^{-n})\right] \\ \pause
H(z^{-1}) &= -z^{2L}H(z) \\ \\ \pause
H(1) &= -H(1) \quad \Longrightarrow \quad H(1) = 0 \\ \pause
H(-1) &= -H(-1) \quad \Longrightarrow \quad H(-1) = 0
\end{align*}
\end{frame}
\begin{frame}
\frametitle{Zero locations (Type III)}
\centering
type-III FIRs always have a zero at $\omega = 0$ and $\omega = \pi$
\end{frame}
\begin{frame}
\frametitle{Zero locations}
\begin{table}[h!]
\centering
\begin{tabular}{lcl}
\bf Filter Type & \bf Relation & \bf Constraint on Zeros \\
\hline
&&\\
\bf Type I & $H(z^{-1}) = z^{M-1}H(z)$ & No constraints \\
\bf Type II & $H(z^{-1}) = z^{M-1}H(z)$ & Zero at $z = -1$ (i.e.\ $\omega = \pi$) \\
\bf Type III & $H(z^{-1}) = -z^{M-1}H(z)$ & Zeros at $z = \pm 1$ (i.e.\ at $\omega = \pi$ , $\omega = 0$) \\
\bf Type IV & $H(z^{-1}) = -z^{M-1}H(z)$ & Zero at $z = 1$ (i.e.\ $\omega = 0$) \\
\end{tabular}
\end{table}
\end{frame}
\begin{frame}
\frametitle{Linear Phase FIR Filters}
\begin{center}
\begin{tabular}{|c|c|c|c|c|c|c|}
\hline
\bf type & \bf length & \bf sym. & \bf delay & \bf zeros & \\ \hline\hline
I & odd & S & integer & & \fex{-2}{2}{2 -3 3 -3 2} \\ \hline
II & even & S & non-int. & $\pm\pi$ & \fex{0}{3}{-2 3 3 -2} \\ \hline
III & odd & A & integer & $0, \pm\pi$ & \fex{-2}{2}{2 -3 0 3 -2} \\ \hline
IV & even & A & non-int. & $0$ & \fex{-1}{2}{2 -3 3 -2} \\ \hline
\end{tabular}
\end{center}
\end{frame}
\intertitle{optimal FIR filter design}
\begin{frame} \frametitle{How do we design linear-phase FIRs?}
\begin{center}
answer: with the Parks-McClellan algorithm
\end{center}
\vspace{2em}
let's work with an example:
\begin{itemize}
\item type I
\item zero phase (work with $H_d(z)$)
\item lowpass characteristc
\end{itemize}
\end{frame}
\begin{frame} \frametitle{Remember the realistic specs}
\begin{center}
\begin{dspPlot}[height=4cm,xtype=freq,yticks=1,xticks=custom,xout=true]{0,1}{-.3,1.3}
\psset{linecolor=blue}
\psline[linewidth=2pt,linecolor=green](0,1)(0.4,1)
\psline[linewidth=2pt,linecolor=red](0.6,0)(1,0)
\psframe[fillstyle=vlines,fillcolor=lightgray,%
hatchcolor=lightgray,hatchangle=20,%
linecolor=lightgray]%
(0.4,-0.3)(0.6,1.3)
\dspCustomTicks[axis=x]{0 0 0.4 $\omega_p$ 0.6 $\omega_s$ 1 $\pi$}
\rput[b](0.2,1.3){passband}
\rput[b](0.5,1.3){\vphantom{p} transition band}
\rput[b](0.8,1.3){stopband}
\end{dspPlot}
\end{center}
\end{frame}
\begin{frame} \frametitle{Setting up the problem}
Intuition \#1: $z$-transform a finite-degree polynomial in $z$
\[
H_d(z) = h_d[0] + \sum_{n = 1}^{L} h_d[n] (z^{n}+z^{-n}) = Q_M(z)
\]
\vspace{2em}
Intuition \#2: Fourier transform also a finite-degree polynomial
\[
H_d(e^{j\omega}) = P_L(x) \qquad x = \cos\omega
\]
\end{frame}
\begin{frame} \frametitle{Setting up the problem}
Intuition \#3: we want
\[
P_L(x) \approx D(x)
\]
\vspace{2em}
\centering
filter design becomes polynomial fitting!
\end{frame}
\begin{frame} \frametitle{Finding the polynomial}
\[
H_d(e^{j\omega}) = h_d[0] + 2\sum_{n = 1}^{L} h_d[n] \cos \omega n
\]
\end{frame}
\begin{frame} \frametitle{Step 1: Chebyshev polynomials}
\begin{align*}
T_0(x) & = 1 \\
T_1(x) & = x \\
T_2(x) & = 2x^2-1 \\
\ldots & \\ \\
T_n(x) &= 2xT_{n-1}(x) - T_{n-2}(x)
\end{align*}
\end{frame}
\begin{frame} \frametitle{Step 1: Chebyshev polynomials}
\centering
fundamental property:
\[
T_n(\cos\omega) = \cos n\omega
\]
\end{frame}
\begin{frame} \frametitle{Step 1: Chebyshev polynomials}
\[
H_d(e^{j\omega}) = h_d[0] + \sum_{n = 1}^{L} 2h_d[n]\cos n\omega
\]
\pause
\[
P(x) = h_d[0] + \sum_{n = 1}^{L} 2h_d[n]T_n(x)\big|_{x =\cos\omega}
\]
\pause
\[
H_d(e^{j\omega}) = P(x)\big|_{x =\cos\omega}
\]
\end{frame}
\begin{frame} \frametitle{Example for a 7-tap filter}
\begin{align*}
H_d(e^{j\omega}) &= a + 2b\cos \omega + 2c\cos 2\omega+ 2 d\cos 3\omega \\ \\ \pause
&= a\,T_0(\cos \omega) + 2b\,T_1(\cos \omega) + 2c\,T_2(\cos \omega) + 2d\,T_3(\cos \omega) \\ \pause
&= a + 2b\cos \omega + 2c(2\cos^2\omega - 1) + 2d(4\cos^3\omega - 3\cos \omega) \\ \pause
&= (a- 2c) + (2b-6d)\cos\omega + 4c\cos^2\omega + 8d\cos^3\omega \\ \\
&= [(a- 2c) + (2b-6d)x + 4c\,x^2 + 8d\,x^3]_{x =\cos\omega}
\end{align*}
\end{frame}
\def\wp{0.3 }
\def\ws{0.6}
\def\sp{ }
\begin{frame} \frametitle{Step 2: Convert the specs}
\begin{center}
\begin{dspPlot}[height=4cm,xtype=freq,yticks=1,xticks=custom,xout=true,ylabel={$x=\cos\omega$}]{0,1}{-1.1,1.1}
\psline[linewidth=4pt,linecolor=green](0,0)(\wp,0)
\psline[linewidth=4pt,linecolor=red](\ws,0)(1,0)
\dspCustomTicks[axis=x]{0 0 {\ws} $\omega_s$ {\wp} $\omega_p$ 1 $\pi$}
\only<2->{\dspFunc{x 180 mul cos}
\psline[linewidth=0.1pt,linestyle=dashed](\wp,0)(! \wp\sp \wp\sp 180 mul cos)(! 0 \wp\sp 180 mul cos)
\psline[linewidth=0.1pt,linestyle=dashed](\ws,0)(! \ws\sp \ws\sp 180 mul cos)(! 0 \ws\sp 180 mul cos)
\psline[linewidth=0.1pt,linestyle=dashed](0,-1)(1,-1)
\psline[linewidth=4pt,linecolor=green](0, 1)(! 0 \wp\sp 180 mul cos)
\psline[linewidth=4pt,linecolor=red](! 0 \ws\sp 180 mul cos)(0, -1)}
\end{dspPlot}
\end{center}
\end{frame}
\begin{frame} \frametitle{Step 2: Convert the specs}
If $x = \cos\omega$
\[
I_p = [0, \, \omega_p] \rightarrow I'_p = [\cos\omega_p, \, 1]
\]
\pause
\[
I_s = [\omega_p, \, \pi] \rightarrow I'_s = [-1, \, \cos\omega_s]
\]
\end{frame}
\begin{frame} \frametitle{Step 2: Convert the specs}
We want
\begin{align*}
P(x) \approx 1 & \quad\mbox{for $x \in I'_p$} \\
P(x) \approx 0 & \quad\mbox{for $x \in I'_s$} \\
\end{align*}
\pause
Global error function
\[
E(x) = P(x) - D(x)
\]
with
\[
D(x) = \begin{cases}
1 &\mbox{for $x \in I'_p$} \\
0 &\mbox{for $x \in I'_s$}
\end{cases}
\]
\end{frame}
\begin{frame} \frametitle{We could try this...}
standard fitting of a degree-$L$ polynomial:
\begin{itemize}
\item pick $L+1$ points over the two intervals
\item build the Vandermode matrix
\[
\mathbf{A} = \begin{bmatrix}
1 & x_0 & x_0^2 & \ldots & x_0^L \\
1 & x_1 & x_1^2 & \ldots & x_1^L \\
\vdots \\
1 & x_L & x_L^2 & \ldots & x_L^L
\end{bmatrix}
\]
\item solve the interpolation problem
\[
\mathbf{Ap} = \begin{bmatrix}
1 \\ 1 \\ \vdots \\ 0 \\ 0
\end{bmatrix}
\]
\end{itemize}
\end{frame}
\begin{frame} \frametitle{... but it wouldn't work}
\begin{itemize}
\item (direct methods numerically unstable)
\item interpolation minimizes the MSE but not the maximum error
\end{itemize}
\end{frame}
\begin{frame} \frametitle{max error vs MSE}
\begin{center}
\begin{dspPlot}[yticks=1,xticks=custom,xout=true,sidegap=0]{-1,1}{-.3, 1.3}
\psline[linewidth=4pt,linecolor=red](-1,0)(-.3,0)
\psline[linewidth=4pt,linecolor=green](.1,1)(1,1)
\begin{dspClip}
\dspFuncOpt[plotpoints=5000]{/P [
9.27206757e-01 1.60659180e+00 -1.13098043e+01 1.84716385e+01
1.05622032e+02 -3.66035580e+02 -3.91399174e+02 2.58803536e+03
2.36736685e+01 -9.64472032e+03 4.35198619e+03 2.05879648e+04
-1.43794542e+04 -2.51794803e+04 2.13141755e+04 1.63510441e+04
-1.53917713e+04 -4.35638640e+03 4.37804987e+03] def}{
x 1 0 P { % x x^n s_n-1 p_n
2 index % x x^n s_n-1 p_n x^n
mul add % x x^n s_n
3 1 roll % s_n x x^n
1 index mul % s_n x x^n+1
3 2 roll % x x^n+1 s_n
} forall
3 1 roll
pop pop}
\end{dspClip}
\end{dspPlot}
\end{center}
\end{frame}
\begin{frame} \frametitle{Brilliant idea: minimize max error}
\[
E = \min_{P(x)} \max_{x \in I'_p \cup I'_s}\{| P(x) - D(x) | \}
\]
\end{frame}
\begin{frame} \frametitle{Alternation Theorem}
\centering
$P(x)$ is the minimax approximation to $D(x)$ if and only if $P(x) - D(x)$ alternates $L+2$ times between $+E$ and $-E$ in $I'_p \cup I'_s$
\end{frame}
\begin{frame} \frametitle{Why Alternation Theorem is key}
\begin{itemize}
\item check candidates: if $P(x)$ satisfies the AT, we're done
\item leads to a numerical algorithm to find $P(x)$: the Remez Exchange
\end{itemize}
\end{frame}
\begin{frame} \frametitle{Step 3: the Remez Algorithm}
\centering
suppose we {\em knew} the positions of the alternations; then we could solve
\vspace{1em}
\[
\begin{bmatrix}
1 & x_0 & x_0^2 & \ldots & x_0^L & \epsilon\\
1 & x_1 & x_1^2 & \ldots & x_1^L & -\epsilon\\
& & & \vdots \\
1 & x_L & x_L^2 & \ldots & x_L^L & (-1)^L\epsilon
\end{bmatrix} \mathbf{p}
=
\begin{bmatrix}
0 \\ 0 \\ \vdots \\ 1
\end{bmatrix}
\]
\vspace{2em}
and find both the polynomial coefficients and $E$
\end{frame}
\begin{frame} \frametitle{Step 3: the Remez Algorithm}
obviously we don't know the positions of the alternations; but we can start with a guess
\begin{itemize}
\item solve the system of equation for the guessed $x_i$
\item check if the solution satisfies the alternation theorem; if so, we're done
\item otherwise, find the extrema of the error and use the locations as new guess; repeat
\end{itemize}
\end{frame}
\begin{frame} \frametitle{Example}
\begin{itemize}
\item $M=9$ ($L=4$)
\item $\omega_p=0.4\pi$
\item $\omega_s=0.6\pi$
\end{itemize}
\vspace{1em}\pause
\begin{itemize}
\item we need at least $L+2 = 6$ alternations
\item 2 alternations always at band edges (otherwise specs not fulfilled)
\item guess the other 4 and apply remez
\end{itemize}
\end{frame}
\def\FIRnA{180 x RadtoDeg sub %
dup cos 0.31357 mul exch %
dup 2 mul cos 0.025065 mul exch %
dup 3 mul cos -0.1155 mul exch %
4 mul cos -0.06632 mul %
add add add %
2 mul 0.47745987 add }
\def\FIRnn{180 x RadtoDeg sub %
dup cos 0.31357 mul exch %
dup 2 mul cos 0.021065 mul exch %
dup 3 mul cos -0.1155 mul exch %
4 mul cos -0.06632 mul %
add add add %
2 mul 0.47745987 add }
\def\FIRerr{0.2169}
\begin{frame}
\frametitle{Remez exchange algorithm}
\begin{columns}
\begin{column}{.5\paperwidth}
\begin{figure}
\begin{dspPlot}[width=4cm,yticks=1,xticks=custom,xout=true,sidegap=0,
xlabel={$I'_s$}]{0,1.255}{-\FIRerr,\FIRerr}
\psset{linecolor=blue}
\dspCustomTicks[axis=x]{0 $-1$ 1.255 $\cos(0.6\pi)$}
\only<2->{\qdisk(1.255,-\FIRerr){3pt}}
\only<3>{{%
\psset{linecolor=red!50}
\qdisk(0.94,\FIRerr){3pt}
\qdisk(0.4,-\FIRerr){3pt}}}
\only<4-5>{%
\qdisk(0.94,\FIRerr){3pt}
\qdisk(0.4,-\FIRerr){3pt}
\dspFunc{\FIRnA -10 mul }}
\only<5->{{%
\psset{linecolor=red!50}
\qdisk(1.05,\FIRerr){3pt}
\qdisk(0.51,-\FIRerr){3pt}}}
\only<6>{%
\qdisk(1.05,\FIRerr){3pt}
\qdisk(0.51,-\FIRerr){3pt}
\dspFunc{\FIRnn -10 mul }}
\end{dspPlot}
\end{figure}
\end{column}
\begin{column}{.5\paperwidth}
\begin{figure}
\begin{dspPlot}[width=4cm,yticks=1,xticks=custom,xout=true,sidegap=0,
xlabel={$I'_p$}]{1.885,3.14}{-\FIRerr,\FIRerr}
\psset{linecolor=blue}
%\multido{\n=1.9+.1}{20}{\qdisk(\n,-\FIRerr){3pt}\qdisk(\n,\FIRerr){3pt}}
\dspCustomTicks[axis=x]{1.885 $\cos(0.4\pi)$ 3.14 $1$}
\only<2->{\qdisk(1.885,\FIRerr){3pt}}
\only<3>{{%
\psset{linecolor=red!50}
\qdisk(2.38,-\FIRerr){3pt}
\qdisk(3.14,\FIRerr){3pt}}}
\only<4-5>{%
\qdisk(2.38,-\FIRerr){3pt}
\qdisk(3.14,\FIRerr){3pt}
\dspFunc{1 \FIRnA sub }}
\only<5->{{%
\psset{linecolor=red!50}
\qdisk(2.37,-\FIRerr){3pt}
\qdisk(3.14,\FIRerr){3pt}}}
\only<6>{%
\qdisk(2.37,-\FIRerr){3pt}
\qdisk(3.14,\FIRerr){3pt}
\dspFunc{1 \FIRnn sub }}
\end{dspPlot}
\end{figure}
\end{column}
\end{columns}
\end{frame}
\begin{frame}
\frametitle{Passband and Stopband Error}
\begin{columns}
\begin{column}{.5\paperwidth}
\begin{figure}
\begin{dspPlot}[width=4cm,yticks=1,xticks=custom,xout=true,sidegap=0,xlabel={$I'_s$}]{0,1.255}{-\FIRerr,\FIRerr}
\psset{linecolor=blue}
\dspFunc{\FIRnn -10 mul }
\dspCustomTicks[axis=x]{0 $-1$ 1.255 $\cos(0.6\pi)$}
\psset{xunit=3.14}
\qdisk(0.17,-\FIRerr){3pt}\uput[u](0.17,-\FIRerr){1}
\qdisk(.33,\FIRerr){3pt} \uput[d](.33,\FIRerr){2}
\qdisk(0.4,-\FIRerr){3pt} \uput[ul](0.4,-\FIRerr){3}
\end{dspPlot}
\end{figure}
\end{column}
\begin{column}{.5\paperwidth}
\begin{figure}
\begin{dspPlot}[width=4cm,yticks=1,xticks=custom,xout=true,sidegap=0,xlabel={$I'_p$}]{1.885,3.14}{-\FIRerr,\FIRerr}
\psset{linecolor=blue}
\dspCustomTicks[axis=x]{1.885 $\cos(0.4\pi)$ 3.14 $1$}
\dspFunc{1 \FIRnn sub }
\psset{xunit=3.14}
\qdisk(0.6,\FIRerr){3pt} \uput{6pt}[dr](0.6,\FIRerr){4}
\qdisk(.76,-\FIRerr){3pt}\uput[u](.76,-\FIRerr){5}
\qdisk(1,\FIRerr){3pt}\uput[dl](1,\FIRerr){6}
\end{dspPlot}
\end{figure}
\end{column}
\end{columns}
\end{frame}
\begin{frame} \frametitle{Tuning the error}
\centering
generally, we want to pay more attention to the error in stopband or passband
\begin{columns}
\begin{column}{.4\paperwidth}
\begin{figure}
\begin{dspPlot}[width=4cm,height=1cm,yticks=custom,xticks=custom,xout=true,sidegap=0,
xlabel={$I'_s$}]{0,1}{-1,1}
\dspCustomTicks[axis=x]{0 -1 1 $\cos(\omega_s)$}
\dspCustomTicks[axis=y]{-1 $-\delta_s$ 1 $\delta_s$ 0 0}
\psframe[fillstyle=vlines,fillcolor=red!40,%
hatchcolor=red!40,hatchangle=20,%
linecolor=red!40]%
(0,-1)(1,1)
\psline[linewidth=2pt,linecolor=red](0,0)(1,0)
\end{dspPlot}
\end{figure}
\end{column}
\begin{column}{.4\paperwidth}
\begin{figure}
\begin{dspPlot}[width=4cm,yticks=custom,xticks=custom,xout=true,sidegap=0,
xlabel={$I_p$}]{0,1}{-1,1}
\dspCustomTicks[axis=x]{0 $\cos(\omega_p)$ 1 1}
\dspCustomTicks[axis=y]{-1 $-\delta_p$ 1 $\delta_p$ 0 0}
\psframe[fillstyle=vlines,fillcolor=green!30,%
hatchcolor=green!30,hatchangle=20,%
linecolor=green!30]%
(0,-1)(1,1)
\psline[linewidth=2pt,linecolor=green](0,0)(1,0)
\end{dspPlot}
\end{figure}
\end{column}
\end{columns}
\begin{center}
Goal: fit $E(x)$ within the boxes.
\end{center}
\end{frame}
\begin{frame} \frametitle{Tuning the error}
\centering
The Alternation Theorem works also with a weighting function:
\[
W(x) = \begin{cases}
1 &\mbox{for $x \in I'_p$} \\
\delta_p/\delta_s &\mbox{for $x \in I'_s$}
\end{cases}
\]
\pause
The updated minimization problem:
\[
\min \max_{x \in I'_p \cup I'_s}\{| W(x)[P(x) - D(x)] | \}
\]
\end{frame}
\begin{frame} \frametitle{Parks-McClellan Algorithm; the full recipe for lowpass}
\setbeamercovered{invisible}
\uncover<1->{User data:}
\begin{itemize}
\item<2-> filter length $M = 2L+1$
\item<3-> $\omega_p$ and $\omega_s$
\item<4-> stopband -to-passband tolerance ratio $\delta_s/\delta_p$
\end{itemize}
\vspace{2em}
\uncover<5->{Run Parks-McClellan algorithm; obtain:}
\begin{itemize}
\item<5-> $M$ filter coefficients
\item<6-> stopband and passband tolerances $\delta_s$ and $\delta_p$
\item<7-> {\color{red}If error too big, increase $M$ and retry.}
\end{itemize}
\end{frame}
\begin{frame} \frametitle{Example revisited}
\begin{itemize}
\item $M=9$ ($L=4$)
\item $\omega_p=0.4\pi$
\item $\omega_s=0.6\pi$
\item $\delta_s/\delta_p = 1/10$
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{Final Result}
\begin{figure}
\begin{dspPlot}[xtype=freq,yticks=1,xticks=2]{0,1}{-.2,1.5}
\moocStyle
\dspFunc{x \dspFIRI{0.47745987 0.31357 0.021065 -0.1155 -0.06632}}
\dspFunc[linewidth=0.5pt,linecolor=red]{x \dspRect{0}{0.8}}
\psline[linewidth=0.5pt,linecolor=green](0.6,0.02169)(1,0.02169)
\psline[linewidth=0.5pt,linecolor=green](0.6,-0.02169)(1,-0.02169)
\psline[linewidth=0.5pt,linecolor=green](0,1.2169)(0.4,1.2169)
\psline[linewidth=0.5pt,linecolor=green](0,0.7831)(0.4,0.7831)
\end{dspPlot}
\end{figure}
\end{frame}
\begin{frame}
\frametitle{Final Result (stopband)}
\begin{figure}
\begin{dspPlot}[xtype=freq,yticks=1,xticks=4]{0.6,1}{-.05,0.05}
\moocStyle
\dspFunc{x \dspFIRI{0.47745987 0.31357 0.021065 -0.1155 -0.06632}}
\dspFunc[linewidth=0.5pt,linecolor=red]{x \dspRect{0}{0.8}}
\psline[linewidth=0.5pt,linecolor=green](0.6,0.02169)(1,0.02169)
\psline[linewidth=0.5pt,linecolor=green](0.6,-0.02169)(1,-0.02169)
\psline[linewidth=0.5pt,linecolor=green](0,1.2169)(0.4,1.2169)
\psline[linewidth=0.5pt,linecolor=green](0,0.7831)(0.4,0.7831)
\end{dspPlot}
\end{figure}
\end{frame}
\begin{frame}
\frametitle{Final Result (Impulse Response)}
\begin{figure}
\begin{dspPlot}[xout=true,yticks=0.2]{-4,4}{-.2,0.6}
\moocStyle
\dspTaps{-4 -0.06632 -3 -0.1155 -2 0.021065 -1 0.31357 0 0.47745987 1 0.31357 2 0.021065 3 -0.1155 4 -0.06632}
\end{dspPlot}
\end{figure}
\end{frame}
\begin{comment}
\begin{frame}
\frametitle{Alternations}
\begin{itemize}
\item Max number of alternations is $L+3$:
\begin{itemize}
\item polynomial degree $L$ has $L-1$ local extrema
\item $\omega_p$ and $\omega_s$ are always alternations
\item sometimes $\omega=0$
\item sometimes $\omega=\pi$
\end{itemize}
\item look at the {\em in band} alternations, that gives you $L-1$
\end{itemize}
\end{frame}
\end{comment}
\begin{frame}
\frametitle{Minimax lowpass filter (recap)}
\begin{columns}
\begin{column}{0.4\paperwidth}
Magnitude response:
\begin{itemize}
\item equiripple in passband \\ and stopband
\end{itemize}
\vspace{2em}
Design parameters:
\begin{itemize}
\item order $N$ (number of taps)
\item passband edge $\omega_p$
\item stopband edge $\omega_s$
\item ratio of passband to \\
stopband error $\delta_p/\delta_s$
\end{itemize}
\end{column}
\pause
\begin{column}{0.4\paperwidth}
Design test criterion:
\begin{itemize}
\item passband max error
\item stopband max error
\end{itemize}
\end{column}
\end{columns}
\end{frame}
\begin{frame}
\frametitle{Minimax lowpass example}
\centering
$N=9, \omega_p = 0.2\pi, \omega_s = 0.3\pi, \delta_p/\delta_s = 10$
\begin{figure}
\begin{dspPlot}[xtype=freq,xticks=4,ylabel={$|H(e^{j\omega})|$}]{-1,1}{0,1.1}
\moocStyle
% coeffs: firpm(8, [0 0.2 0.3 1], [1 1 0 0], [10,1])
\dspFunc{x \dspTFM{ -0.175712354496923 0.129288676913797 0.180455858400540 0.234878415331652
0.257936004460746 0.234878415331652 0.180455858400540 0.129288676913797 -0.175712354496923}{1}}
\end{dspPlot}
\end{figure}
\end{frame}
\begin{frame}
\frametitle{Minimax lowpass example}
\centering
$N=19, \omega_p = 0.2\pi, \omega_s = 0.3\pi, \delta_p/\delta_s = 10$
\begin{figure}
\begin{dspPlot}[xtype=freq,xticks=4,ylabel={$|H(e^{j\omega})|$}]{-1,1}{0,1.1}
\moocStyle
% coeffs: firpm(18, [0 0.2 0.3 1], [1 1 0 0], [10,1])
\dspFunc{x \dspTFM{-0.001120184908392 0.085181123373292 -0.044324201033833 -0.055598029320939
-0.049803997774758 -0.010060733381839 0.065431562208223 0.157228546785209
0.232649571862615 0.261795906445800 0.232649571862615 0.157228546785209
0.065431562208223 -0.010060733381839 -0.049803997774758 -0.055598029320939
-0.044324201033833 0.085181123373292 -0.001120184908392}{1}}
\end{dspPlot}
\end{figure}
\end{frame}
\begin{frame}
\frametitle{Minimax lowpass example}
\centering
$N=51, \omega_p = 0.2\pi, \omega_s = 0.3\pi, \delta_p/\delta_s = 1$
\begin{figure}
\begin{dspPlot}[xtype=freq,xticks=4,ylabel={$|H(e^{j\omega})|$}]{-1,1}{0,1.1}
\moocStyle
% coeffs: firpm(50, [0 0.2 0.3 1], [1 1 0 0], [1,1])
\dspFunc{x \dspTFM{ 0.002184751913328 -0.000636387168042 -0.002321266010324 -0.003684703237659
-0.003201460277371 -0.000229555810906 0.004114295334440 0.007138532599280
0.006070713198253 0.000144041476633 -0.008099980593059 -0.013521817362168
-0.011237343036912 -0.000197270611214 0.014813892101174 0.024611303196966
0.020483272658574 0.000222340867578 -0.028240467793545 -0.048446158085879
-0.042440020759802 -0.000240423842876 0.073179747484826 0.157573555887813
0.224693865780418 0.250248677252314 0.224693865780418 0.157573555887813
0.073179747484826 -0.000240423842876 -0.042440020759802 -0.048446158085879
-0.028240467793545 0.000222340867578 0.020483272658574 0.024611303196966
0.014813892101174 -0.000197270611214 -0.011237343036912 -0.013521817362168
-0.008099980593059 0.000144041476633 0.006070713198253 0.007138532599280
0.004114295334440 -0.000229555810906 -0.003201460277371 -0.003684703237659
-0.002321266010324 -0.000636387168042 0.002184751913328}{1}}
\end{dspPlot}
\end{figure}
\end{frame}
\begin{frame}
\frametitle{Magnitude response in decibels}
\begin{itemize}
\item filter max passband magnitude $G$
\item filter attenuation expressed in decibels as:
\[
A_{\mbox{dB}} = 20 \log_{10}(|H(e^{j\omega})|/G)
\]
\item useful to compare attenuations between filters
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{4th-order elliptic lowpass, $\omega_c=\pi/4$, log scale}
\begin{figure}
\begin{dspPlot}[xtype=freq,xticks=4,yticks=20,ylabel={$A(e^{j\omega})$ (dB)},xout=true]{-1,1}{-100,0}
\moocStyle
% coeffs: [b a]=ellip(4,0.5,15,0.25)
\begin{dspClip}
\dspFunc{x \dspTFM{0.1866 -0.3248 0.4782 -0.3248 0.1866}{1.0000 -2.4512 2.8891 -1.6623 0.4380} log 20 mul}
\end{dspClip}
\end{dspPlot}
\end{figure}
\end{frame}
\begin{frame}
\frametitle{9-tap minimax lowpass, $\omega_c=\pi/4$, log scale}
\begin{figure}
\begin{dspPlot}[xtype=freq,xticks=4,yticks=20,ylabel={$A(e^{j\omega})$ (dB)},xout=true]{-1,1}{-100,0}
\moocStyle
% coeffs: firpm(51, [0 0.4 0.6 1], [1 1 0 0],[10 1])
\begin{dspClip}
\dspFunc[linecolor=lightgray]{x \dspTFM{0.1866 -0.3248 0.4782 -0.3248 0.1866}{1.0000 -2.4512 2.8891 -1.6623 0.4380} log 20 mul}
\dspFunc{x \dspTFM{ -0.175712354496923 0.129288676913797 0.180455858400540 0.234878415331652 0.257936004460746 0.234878415331652 0.180455858400540 0.129288676913797 -0.175712354496923}{1} log 20 mul}
\end{dspClip}
\end{dspPlot}
\end{figure}
\end{frame}
\begin{frame}
\frametitle{19-tap minimax lowpass, $\omega_c=\pi/4$, log scale}
\begin{figure}
\begin{dspPlot}[xtype=freq,xticks=4,yticks=20,ylabel={$A(e^{j\omega})$ (dB)},xout=true]{-1,1}{-100,0}
\moocStyle
% coeffs: firpm(51, [0 0.4 0.6 1], [1 1 0 0],[10 1])
\begin{dspClip}
\dspFunc[linecolor=lightgray]{x \dspTFM{0.1866 -0.3248 0.4782 -0.3248 0.1866}{1.0000 -2.4512 2.8891 -1.6623 0.4380} log 20 mul}
\dspFunc{x \dspTFM{-0.001120184908392 0.085181123373292 -0.044324201033833 -0.055598029320939
-0.049803997774758 -0.010060733381839 0.065431562208223 0.157228546785209
0.232649571862615 0.261795906445800 0.232649571862615 0.157228546785209
0.065431562208223 -0.010060733381839 -0.049803997774758 -0.055598029320939
-0.044324201033833 0.085181123373292 -0.001120184908392}{1} log 20 mul}
\end{dspClip}
\end{dspPlot}
\end{figure}
\end{frame}
\begin{frame}
\frametitle{51-tap minimax lowpass, $\omega_c=\pi/4$, log scale}
\begin{figure}
\begin{dspPlot}[xtype=freq,xticks=4,yticks=40,ylabel={$|H(e^{j\omega})|$ (dB)},xout=true]{-1,1}{-200,0}
\moocStyle
% coeffs: firpm(51, [0 0.4 0.6 1], [1 1 0 0],[10 1])
\begin{dspClip}
\dspFunc[linecolor=lightgray]{x \dspTFM{0.1866 -0.3248 0.4782 -0.3248 0.1866}{1.0000 -2.4512 2.8891 -1.6623 0.4380} log 20 mul}
\dspFunc{x \dspTFM{0.002184751913328 -0.000636387168042 -0.002321266010324 -0.003684703237659
-0.003201460277371 -0.000229555810906 0.004114295334440 0.007138532599280
0.006070713198253 0.000144041476633 -0.008099980593059 -0.013521817362168
-0.011237343036912 -0.000197270611214 0.014813892101174 0.024611303196966
0.020483272658574 0.000222340867578 -0.028240467793545 -0.048446158085879
-0.042440020759802 -0.000240423842876 0.073179747484826 0.157573555887813
0.224693865780418 0.250248677252314 0.224693865780418 0.157573555887813
0.073179747484826 -0.000240423842876 -0.042440020759802 -0.048446158085879
-0.028240467793545 0.000222340867578 0.020483272658574 0.024611303196966
0.014813892101174 -0.000197270611214 -0.011237343036912 -0.013521817362168
-0.008099980593059 0.000144041476633 0.006070713198253 0.007138532599280
0.004114295334440 -0.000229555810906 -0.003201460277371 -0.003684703237659
-0.002321266010324 -0.000636387168042 0.002184751913328}{1} log 20 mul}
\end{dspClip}
\end{dspPlot}
\end{figure}
\end{frame}
\begin{frame} \frametitle{Life beyond lowpass}
The IIR and FIR methods we just described can be used to design more general filter types than lowpass, with only minor modifications
\begin{itemize}[<+->]
\item IIR bandpass and highpass can be obtain by modulating the lowpass response
\item optimal FIR bandpass and highpass can be designed by the Parks-McClellan algorithm
\item optimal FIR can also be designed with piecewise linear magnitude response
\item the literature on filter design is vast: this is just the tip of the iceberg!
\end{itemize}
\end{frame}
\begin{frame} \frametitle{Play with the demo!}
\centering\Large
Play with the interactive minimax filter design demo
\vspace{2em}
\url{https://github.com/prandoni/COM303/tree/master/MiniMax}
\end{frame}
\end{document}
\begin{frame}
\frametitle{Type-I Lowpass Minimax Design}
remarks:
\begin{itemize}
\item design zero-centered filter $H_d(z)$ (zero phase)
\item frequency response will be real-valued
\item design technique works for other types with minor modifications
\end{itemize}
\end{frame}
\begin{frame} \frametitle{Step 2: Convert the specs}
We want
\begin{align*}
|P(x) - 1| < \delta_p & \quad\mbox{for $x \in I'_p$} \\
|P(x)| < \delta_s & \quad\mbox{for $x \in I'_s$} \\
\end{align*}
\pause
Global error function
\[
E(x) = P(x) - D(x)
\]
with
\[
D(x) = \begin{cases}
1 &\mbox{for $x \in I'_p$} \\
0 &\mbox{for $x \in I'_s$}
\end{cases}
\]
\end{frame}
\begin{frame}
\frametitle{Type-I Lowpass Minimax Design: Specs}
\begin{center}
\begin{dspPlot}[height=4cm,xtype=freq,yticks=1,xticks=custom,xout=true]{0,1}{-.3,1.3}
\psset{linecolor=blue}
\psframe[fillstyle=vlines,fillcolor=green!30,%
hatchcolor=green!30,hatchangle=20,%
linecolor=green!30]%
(0,1.2)(0.4,0.8)
\psline[linewidth=2pt,linecolor=green](0,1)(0.4,1)
\psframe[fillstyle=vlines,fillcolor=red!40,%
hatchcolor=red!40,hatchangle=20,%
linecolor=red!40]%
(0.6,0.1)(1,-0.1)
\psline[linewidth=2pt,linecolor=red](0.6,0)(1,0)
\psframe[fillstyle=vlines,fillcolor=lightgray,%
hatchcolor=lightgray,hatchangle=20,%
linecolor=lightgray]%
(0.4,-0.3)(0.6,1.3)
\dspCustomTicks[axis=x]{0 0 0.4 $\omega_p$ 0.6 $\omega_s$ 1 $\pi$}
\rput[b](0.2,1.3){passband}
\rput[b](0.5,1.3){\vphantom{p} transition band}
\rput[b](0.8,1.3){stopband}
\end{dspPlot}
\end{center}
\end{frame}
\begin{frame}
\frametitle{Parks-McClellan Algorithm}
\setbeamercovered{invisible}
\uncover<1->{User data:}
\begin{itemize}
\item<2-> filter length $M = 2L+1$
\item<3-> $\omega_p$ and $\omega_s$
\item<4-> stopband -to-passband tolerance ratio $\delta_s/\delta_p$
\end{itemize}
\vspace{2em}
\uncover<5->{Run Parks-McClellan algorithm; obtain:}
\begin{itemize}
\item<5-> $M$ filter coefficients
\item<6-> stopband and passband tolerances $\delta_s$ and $\delta_p$
\end{itemize}
\centering
\color{red}
\uncover<7->{If error too big, increase $M$ and retry.}
\end{frame}
\begin{frame}
\frametitle{Graphically}
\begin{columns}
\begin{column}{.4\paperwidth}
\begin{figure}
\begin{dspPlot}[width=4cm,yticks=custom,xticks=custom,xout=true,sidegap=0,
xlabel={$I_p$}]{0,1}{0,1}
\dspCustomTicks[axis=x]{0 0 1 $\omega_p$}
\dspCustomTicks[axis=y]{0 $1-\delta_p$ 1 $1+\delta_p$ 0.5 1}
\psframe[fillstyle=vlines,fillcolor=green!30,%
hatchcolor=green!30,hatchangle=20,%
linecolor=green!30]%
(0,0)(1,1)
\psline[linewidth=2pt,linecolor=green](0,0.5)(1,0.5)
\end{dspPlot}
\end{figure}
\end{column}
\begin{column}{.4\paperwidth}
\begin{figure}
\begin{dspPlot}[width=4cm,height=1cm,yticks=custom,xticks=custom,xout=true,sidegap=0,
xlabel={$I_s$}]{0,1}{-1,1}
\dspCustomTicks[axis=x]{0 $\omega_s$ 1 $\pi$}
\dspCustomTicks[axis=y]{-1 $-\delta_s$ 1 $\delta_s$}
\psframe[fillstyle=vlines,fillcolor=red!40,%
hatchcolor=red!40,hatchangle=20,%
linecolor=red!40]%
(0,-1)(1,1)
\psline[linewidth=2pt,linecolor=red](0,0)(1,0)
\end{dspPlot}
\end{figure}
\end{column}
\end{columns}
\begin{center}
Goal: fit $H_d(e^{j\omega})$ within the boxes.
\end{center}
\end{frame}
\begin{frame}
\frametitle{How does it work?}
\begin{itemize}[<+->]
\item use Chebyshev polynomials to transform $H_d(e^{j\omega})$ into $P(x)$
\item rewrite specifications to obtain global error function $E(x)$ over passband + stopband
\item iteratively adjust extrema of the error function
\item use alternation theorem as stopping condition
\item verify stopband and passband error; increase $M$ and repeat if necessary
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{Alternation Theorem}
Ingredients:
\begin{itemize}
\item $\{I_k \}$ set of disjoint intervals on the real line, $I = \bigcup_k I_k$
\item $P(x)$ polynomial of degree $L$,
\item $D(x)$ target function
\item $W(x)$ positive weighting function
\item $E(x) = W(x)[D(x) - P(x)]$ approximation error function
\item $E_{\max} = \max_{x \in I} \{|E(x)|\}$
\end{itemize}
\pause
\vspace{1em}
$P(x)$ is the \emph{unique} order-$L$ polynomial which minimizes $E_{\max}$ if and only if there exist \emph{at least} $L+2$ successive values $x_i$ in $I$ such that $|E(x_i)| = E_{\max}$ and $E(x_i) = -E(x_{i+1})$.
\end{frame}

Event Timeline