|
6 | 6 | "source": [ |
7 | 7 | "# Realization of Non-Recursive Filters\n", |
8 | 8 | "\n", |
9 | | - "*This jupyter/Python notebook is part of a [collection of notebooks](../index.ipynb) in the masters module [Digital Signal Processing](http://www.int.uni-rostock.de/Digitale-Signalverarbeitung.48.0.html), Comunications Engineering, Universität Rostock. Please direct questions and suggestions to <mailto:[email protected]>.*" |
| 9 | + "*This jupyter notebook is part of a [collection of notebooks](../index.ipynb) on various topics of Digital Signal Processing. Please direct questions and suggestions to [[email protected]](mailto:[email protected]).*" |
10 | 10 | ] |
11 | 11 | }, |
12 | 12 | { |
|
28 | 28 | "\n", |
29 | 29 | "The output signal $y[k]$ of a non-recursive filter with a finite impulse response (FIR) $h[k]$ of length $N$ is given as\n", |
30 | 30 | "\n", |
31 | | - "$$ y[k] = h[k] * x[k] = \\sum_{\\kappa = 0}^{N-1} h[\\kappa] \\; x[k - \\kappa] $$\n", |
| 31 | + "\\begin{equation}\n", |
| 32 | + "y[k] = h[k] * x[k] = \\sum_{\\kappa = 0}^{N-1} h[\\kappa] \\; x[k - \\kappa]\n", |
| 33 | + "\\end{equation}\n", |
32 | 34 | "\n", |
33 | 35 | "where $x[k]$ denotes the input signal. The quantized impulse response $h_Q[k]$ (quantized filter coefficients) is yielded by quantizing the impulse response $h[k]$\n", |
34 | 36 | "\n", |
35 | | - "$$ h_Q[k] = \\mathcal{Q} \\{ h[k] \\} = h[k] + e[k] $$\n", |
| 37 | + "\\begin{equation}\n", |
| 38 | + "h_Q[k] = \\mathcal{Q} \\{ h[k] \\} = h[k] + e[k]\n", |
| 39 | + "\\end{equation}\n", |
36 | 40 | "\n", |
37 | 41 | "where $e[k] = h_Q[k] - h[k]$ denotes the [quantization error](../quantization/introduction.ipynb#Model-of-the-Quantization-Process). Introducing $h_Q[k]$ into above equation and rearranging results in\n", |
38 | 42 | "\n", |
39 | | - "$$ y_Q[k] = \\sum_{\\kappa = 0}^{N-1} h[k] \\; x[k - \\kappa] + \\sum_{\\kappa = 0}^{N-1} e[k] \\; x[k - \\kappa] $$\n", |
| 43 | + "\\begin{equation}\n", |
| 44 | + "y_Q[k] = \\sum_{\\kappa = 0}^{N-1} h[k] \\; x[k - \\kappa] + \\sum_{\\kappa = 0}^{N-1} e[k] \\; x[k - \\kappa]\n", |
| 45 | + "\\end{equation}\n", |
40 | 46 | "\n", |
41 | 47 | "The input signal $x[k]$ is filtered by the quantization noise $e[k]$ and superimposed to the desired output of the filter. The overall transfer function $H_Q(e^{j \\Omega})$ of the filter with quantized filter coefficients is given as\n", |
42 | 48 | "\n", |
43 | | - "$$ H_Q(e^{j \\Omega}) = \\sum_{k=0}^{N-1} h[k] \\; e^{-j \\Omega k} + \\sum_{k=0}^{N-1} e[k] \\; e^{-j \\Omega k} = H(e^{j \\Omega}) + E(e^{j \\Omega}) $$\n", |
| 49 | + "\\begin{equation}\n", |
| 50 | + "H_Q(e^{j \\Omega}) = \\sum_{k=0}^{N-1} h[k] \\; e^{-j \\Omega k} + \\sum_{k=0}^{N-1} e[k] \\; e^{-j \\Omega k} = H(e^{j \\Omega}) + E(e^{j \\Omega})\n", |
| 51 | + "\\end{equation}\n", |
44 | 52 | "\n", |
45 | 53 | "Hence, the quantization of filter coefficients results in a linear distortion of the desired frequency response. To some extend this distortion can be incorporated into the design of the filter. However, the magnitude of the quantization error $| E(e^{j \\Omega}) |$ cannot get arbitrarily small for a finite quantization step $Q$. This limits the achievable attenuation of a digital filter with quantized coefficients. It is therefore important to normalize the filter coefficients $h[k]$ before quantization in order to keep the relative power of the quantization noise small." |
46 | 54 | ] |
|
145 | 153 | "\n", |
146 | 154 | "As outlined above, multipliers require a requantization of the result in order to keep the wordlength constant. The multiplication of a quantized signal $x_Q[k]$ with a quantized factor $a_Q$ can be written as\n", |
147 | 155 | "\n", |
148 | | - "$$ y_Q[k] = \\mathcal{Q} \\{ a_Q \\cdot x_Q[k] \\} = a_Q \\cdot x_Q[k] + e[k]$$\n", |
| 156 | + "\\begin{equation}\n", |
| 157 | + "y_Q[k] = \\mathcal{Q} \\{ a_Q \\cdot x_Q[k] \\} = a_Q \\cdot x_Q[k] + e[k]\n", |
| 158 | + "\\end{equation}\n", |
149 | 159 | "\n", |
150 | 160 | "where the round-off error $e[k]$ is defined as\n", |
151 | 161 | "\n", |
152 | | - "$$ e[k] = y_Q[k] - a_Q \\cdot x_Q[k] $$\n", |
| 162 | + "\\begin{equation}\n", |
| 163 | + "e[k] = y_Q[k] - a_Q \\cdot x_Q[k]\n", |
| 164 | + "\\end{equation}\n", |
153 | 165 | "\n", |
154 | 166 | "This leads to the following model of a multiplier including round-off effects\n", |
155 | 167 | "\n", |
|
169 | 181 | "\n", |
170 | 182 | "The variance (power) of the round-off error is [derived from its PDF](../random_signals/important_distributions.ipynb#Uniform-Distribution) as\n", |
171 | 183 | "\n", |
172 | | - "$$ \\sigma_e^2 = \\frac{Q^2}{12} $$" |
| 184 | + "\\begin{equation}\n", |
| 185 | + "\\sigma_e^2 = \\frac{Q^2}{12}\n", |
| 186 | + "\\end{equation}" |
173 | 187 | ] |
174 | 188 | }, |
175 | 189 | { |
|
180 | 194 | "\n", |
181 | 195 | "Using above model of a multiplier and discarding clipping, a straightforward realization of the convolution with quantized signals would be to requantize after every multiplication \n", |
182 | 196 | "\n", |
183 | | - "$$ y_Q[k] = \\sum_{\\kappa = 0}^{N-1} \\mathcal{Q} \\{ h_Q[\\kappa] \\; x_Q[k - \\kappa] \\} = \\sum_{\\kappa = 0}^{N-1} h_Q[\\kappa] \\; x_Q[k - \\kappa] + e[\\kappa]$$\n", |
| 197 | + "\\begin{equation}\n", |
| 198 | + "y_Q[k] = \\sum_{\\kappa = 0}^{N-1} \\mathcal{Q} \\{ h_Q[\\kappa] \\; x_Q[k - \\kappa] \\} = \\sum_{\\kappa = 0}^{N-1} h_Q[\\kappa] \\; x_Q[k - \\kappa] + e[\\kappa]\n", |
| 199 | + "\\end{equation}\n", |
184 | 200 | "\n", |
185 | 201 | "The round-off errors for each multiplication are uncorrelated to each other. The overall power of the round-off error is then given as\n", |
186 | 202 | "\n", |
187 | | - "$$ \\sigma_e^2 = N \\cdot \\frac{Q^2}{12}$$\n", |
| 203 | + "\\begin{equation}\n", |
| 204 | + "\\sigma_e^2 = N \\cdot \\frac{Q^2}{12}\n", |
| 205 | + "\\end{equation}\n", |
188 | 206 | "\n", |
189 | 207 | "Many digital signal processors allow to perform the multiplications and additions in an internal register with double wordlength. In this case only the result has to be requantized \n", |
190 | 208 | "\n", |
191 | | - "$$ y_Q[k] = \\mathcal{Q} \\left\\{ \\sum_{\\kappa = 0}^{N-1} h_Q[\\kappa] \\; x_Q[k - \\kappa] \\right\\}$$\n", |
| 209 | + "\\begin{equation}\n", |
| 210 | + "y_Q[k] = \\mathcal{Q} \\left\\{ \\sum_{\\kappa = 0}^{N-1} h_Q[\\kappa] \\; x_Q[k - \\kappa] \\right\\}\n", |
| 211 | + "\\end{equation}\n", |
192 | 212 | "\n", |
193 | 213 | "and the power of the round-off noise in this case is\n", |
194 | 214 | "\n", |
195 | | - "$$ \\sigma_e^2 = \\frac{Q^2}{12} $$\n", |
| 215 | + "\\begin{equation}\n", |
| 216 | + "\\sigma_e^2 = \\frac{Q^2}{12}\n", |
| 217 | + "\\end{equation}\n", |
196 | 218 | "\n", |
197 | 219 | "It is evident that this realization is favorable due to the lower round-off noise, especially for filters with a large number $N$ of coefficients." |
198 | 220 | ] |
|
306 | 328 | "source": [ |
307 | 329 | "**Copyright**\n", |
308 | 330 | "\n", |
309 | | - "<p xmlns:dct=\"http://purl.org/dc/terms/\">\n", |
310 | | - " <a rel=\"license\"\n", |
311 | | - " href=\"http://creativecommons.org/publicdomain/zero/1.0/\">\n", |
312 | | - " <img src=\"http://i.creativecommons.org/p/zero/1.0/88x31.png\" style=\"border-style: none;\" alt=\"CC0\" />\n", |
313 | | - " </a>\n", |
314 | | - " <br />\n", |
315 | | - " To the extent possible under law,\n", |
316 | | - " <span rel=\"dct:publisher\" resource=\"[_:publisher]\">the person who associated CC0</span>\n", |
317 | | - " with this work has waived all copyright and related or neighboring\n", |
318 | | - " rights to this work.\n", |
319 | | - "</p>" |
| 331 | + "This notebook is provided as [Open Educational Resource](https://en.wikipedia.org/wiki/Open_educational_resources). Feel free to use the notebook for your own purposes. The text is licensed under [Creative Commons Attribution 4.0](https://creativecommons.org/licenses/by/4.0/), the code of the IPython examples under the [MIT license](https://opensource.org/licenses/MIT). Please attribute the work as follows: *Sascha Spors, Digital Signal Processing - Lecture notes featuring computational examples, 2016*." |
320 | 332 | ] |
321 | 333 | } |
322 | 334 | ], |
|
0 commit comments