Skip to content

Commit 2130018

Browse files
committed
causal, symmetry
1 parent 1ab5a1c commit 2130018

1 file changed

Lines changed: 29 additions & 12 deletions

File tree

‎Filtering.ipynb‎

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -310,38 +310,57 @@
310310
"\n",
311311
"Note that this reduces to the Fourier transform with $ z=\\exp \\left( j\\omega \\right) $ and that this notation emphasizes the transfer function as a polynomial of the complex variable $z$. Thus, for our filter, we have\n",
312312
"\n",
313-
"$$ H(z) = \\sum_{n=0}^M h_n z^n = \\frac{1}{8} \\sum_{n=0}^M z^n = (1+z)(1+z^2)(1+z^4) $$\n",
313+
"$$ H(z) = \\sum_{n=0}^{M-1} h_n z^n = \\frac{1}{8} \\sum_{n=0}^7 z^n = (1+z)(1+z^2)(1+z^4) $$\n",
314314
"\n",
315-
"Thus, the first zero occurs when $z=-1$ or when $ \\exp(j\\omega) = -1 \\Rightarrow \\omega=\\pi$. The next pair of zeros occurs when $z= \\pm j$ which corresponds to $ \\omega = \\pm \\pi/2 $"
315+
"Thus, the first zero occurs when $z=-1$ or when $ \\exp(j\\omega) = -1 \\Rightarrow \\omega=\\pi$. The next pair of zeros occurs when $z= \\pm j$ which corresponds to $ \\omega = \\pm \\pi/2 $. Notice that any filter with this $ z+1 $ term will zero out the $ \\omega=\\pi $ (highest) frequency. Likewise, the term $ z-1 $ means that the filter zeros out $ \\omega=0 $. "
316316
]
317317
},
318318
{
319319
"cell_type": "markdown",
320320
"metadata": {},
321321
"source": [
322-
"## Causality, Zero-Phase, Symmetry\n",
322+
"## Symmetry\n",
323+
"\n",
324+
"There is a special case when the input sequence is symmetric,\n",
325+
"\n",
326+
"$$ x_n = x_{-n} $$\n",
327+
"\n",
328+
"which leads to a real-valued (i.e. zero-phase) Fourier transform property,\n",
323329
"\n",
324-
"The FIR filter is the convolution of the input sequence $ x_n $ with the filter sequence $ h_n $ whose DFT equals the product of the corresponding DFTs of the input and filter sequence. That is,\n",
330+
"$$ H(\\omega)= x_0+\\sum_{n \\gt 0} 2 x_n \\cos\\left(\\omega n \\right) $$\n",
325331
"\n",
326-
"$$ H(\\omega) = \\sum_n h_n \\exp \\left( -j\\omega n \\right) $$\n",
332+
"When the input is anti-symmetric,\n",
333+
"\n",
334+
"$$ x_n = -x_{-n} $$\n",
335+
"\n",
336+
"$$ H(\\omega)= j\\sum_{n \\gt 0} 2 x_n \\sin\\left(\\omega n \\right) $$\n",
337+
"\n",
338+
"The Fourier transform is purely imaginary. Note that $ x_n = -x_{-n} $ for $ n=0 $ means that $ x_0=0 $."
339+
]
340+
},
341+
{
342+
"cell_type": "markdown",
343+
"metadata": {},
344+
"source": [
345+
"## Causality, Zero-Phase, Symmetry\n",
327346
"\n",
328347
"In our first moving average filter example with $ h_0 = h_1 = 1/2$, if we changed the indexing so that $ h_{-1} = h_1 $, then we would have symmetry around zero with the following Fourier transform ,\n",
329348
"\n",
330349
"$$ H(\\omega) = \\frac{1}{2} \\exp \\left( j\\omega \\right) + \\frac{1}{2} \\exp\\left( -j\\omega \\right) = \\cos(\\omega) $$\n",
331350
"\n",
332-
"which is a *real* function of frequency with zero-phase. While this would be nice theoretically, it is not possible practically because it requires future-knowledge of input sequence as shown below\n",
351+
"which is a *real* function of frequency with zero-phase. While this is nice theoretically, it is not possible practically because it requires future-knowledge of input sequence as shown below\n",
333352
"\n",
334353
"$$ y_n = \\sum_{k=0}^{M-1} h_n x_{n-k} = y_n = h_{-1} x_{n+1}+h_{1} x_{n-1} = \\left( x_{n+1}+x_{n-1} \\right)/2 $$\n",
335354
"\n",
336-
"which shows that $ y_n $ depends on th future value of $ x_{n+1} $. This is what non-causal means and we must omit this kind of symmetry about 0 from our class of admissible filter coefficents. However, we can scoot the symmetric point to the center of the sequence at the cost of introducing a linear phase factor, $ \\exp \\left( j \\omega N/2 \\right) $. Filters with linear phase do not distort the input phase across frequency. This means that all frequency components of the signal emerge at the other end of the filter in the same order they entered it. Otherwise, it would be very hard to retrieve any information embedded in signal phase in later processing. Thus, causal filters have symmetric coeffients,\n",
355+
"which shows that $ y_n $ depends on th future value of $ x_{n+1} $. This is what non-causal means and we must omit this kind of symmetry about zero from our class of admissible filter coefficents. However, we can scoot the symmetric point to the center of the sequence at the cost of introducing a linear phase factor, $ \\exp\\left(-j\\omega (M-1)/2 \\right) $ for even $ M $. Filters with linear phase do not distort the input phase across frequency. This means that all frequency components of the signal emerge at the other end of the filter in the same order they entered it. Otherwise, it would be very hard to retrieve any information embedded in the signal's phase in later processing. Thus, we can build linear phase causal filters have symmetric coefficients,\n",
337356
"\n",
338-
"$$ h_n = h_{N-n} $$\n",
357+
"$$ h_n = h_{M-1-n} $$\n",
339358
"\n",
340359
"or anti-symmetric coefficients,\n",
341360
"\n",
342-
"$$ h_n = -h_{N-n} $$\n",
361+
"$$ h_n = -h_{M-1-n} $$\n",
343362
"\n",
344-
"This further restricts the space of admissible filter coefficients."
363+
"by putting the point of symmetry at $ (M-1)/2 $ for even $ M $. "
345364
]
346365
},
347366
{
@@ -365,8 +384,6 @@
365384
"cell_type": "markdown",
366385
"metadata": {},
367386
"source": [
368-
"line is that there are many engineering trade-offs involved in choosing window functions for particular application. Understanding how window functions are used in spectral analysis is fundamental to the entire field of signal processing because it touches all of the key engineering problems encountered in practice.\n",
369-
"\n",
370387
"As usual, the corresponding IPython notebook for this post is available for download [here](https://github.com/unpingco/Python-for-Signal-Processing/blob/master/Windowing_Part3.ipynb). \n",
371388
"\n",
372389
"Comments and corrections welcome!"

0 commit comments

Comments
 (0)