Wave Walker DSP

DSP Algorithms for RF Systems

New Posts Wednesday!

Most Popular

Aliasing, Sampling and Spinning Car Tires
November 10, 2021

Table of Contents

Introduction

You know how on car commercials sometimes it looks like the wheel is spinning backwards? How weird is that? The effect is called aliasing and it occurs when the wheel’s rotation rate is faster than twice the frame rate of the video camera. You can watch a video below that demonstrates aliasing on car tires as well as a video where it appears that a helicopter’s blades have stopped spinning due to a similar effect.

Aliasing is a form of distortion and your DSP systems can be effected by it if not designed appropriately. It might be worth while reviewing the post on frequency and negative frequency before continuing onto the the body of this post.

My book Fundamentals of 

More blog posts on complex sinusoids:

Aliasing in Sinusoids

Let’s look at some sinusoids with different frequencies. Figure 1 displays the sinusoids

(1)   \begin{equation*}sin(2\pi 0.125 n), ~sin(2\pi 0.25 n), ~sin(2\pi 0.5 n), ~sin(2\pi 0.725 n), ~sin(2\pi 0.875 n).\end{equation*}

Figure 1: Sinusoids in the time-domain with frequencies f/fs = 0.125, 0.25, 0.5, 0.75, 0.875. Aliasing occurs in the sinusoids when f/fs > 0.5.
Figure 1: Sinusoids in the time-domain with frequencies f/fs = 0.125, 0.25, 0.5, 0.75, 0.875. Aliasing occurs in the sinusoids when f/fs > 0.5.

A strange effect happens when f/f_s > 0.5 as larger frequencies appears as smaller frequencies. Compare \sin\left(2\pi 0.125 n\right) against \sin\left(2\pi 0.875 n\right) in Figure 1. Both sinusoids appear to have the same frequency of f/f_s = 0.125 but are 180 degrees out of phase. The larger frequency sinusoid can be represented with a negative frequency f/f_s = -0.125,

(2)   \begin{equation*}sin(2\pi 0.875 n) = sin(2 \pi (-0.125) n) = -sin(2 \pi 0.125 n).\end{equation*}

Similarly \sin\left(2\pi 0.25 n\right) looks to have the same frequency as \sin\left(2\pi 0.75 n\right), f/f_s = 0.25, and they are also 180 degrees out of phase. The larger frequency sinusoid can be represented with a negative frequency f/f_s = -0.25,

(3)   \begin{equation*}sin(2\pi 0.75 n) = sin(2 \pi (-0.25) n) = -sin(2 \pi 0.25 n).\end{equation*}

Finally, and maybe weirdest of all, \sin\left(2\pi 0.5 n\right) = 0 for all n.

If you’ve seen this effect before you’ll know it’s due to aliasing as a result of the Nyquist sampling theorem. Before jumping into that let’s take a look at aliasing in the context of the unit circle.

Aliasing on the Unit Circle

Where Figure 1 only plotted the imaginary portion of a complex sinusoid in the time domain as in (1),

(4)   \begin{equation*}sin\left(2\pi (f/f_s) n \right) = \text{IM} \left( e^{j 2 \pi (f/f_s) n} \right),\end{equation*}

Figure 2 to Figure 6 display both the real and imaginary parts of the complex sinusoid on the unit circle where the complex sinusoids are given by

(5)   \begin{equation*}\begin{split}x_{0}[n] & = e^{j2\pi 0.125 n}, \\x_{1}[n] & = e^{j2\pi 0.25 n}, \\x_{2}[n] & = e^{j2\pi 0.5 n}, \\x_{3}[n] & = e^{j2\pi 0.75 n}, \\x_{4}[n] & = e^{j2\pi 0.875 n}. \\\end{split}\end{equation*}

Figure 2 shows the complex sinusoid x_{0}[n] = e^{j2\pi 0.125n} for n=0 to n=7. The angle of the complex sinusoid \sphericalangle{x_{0}[n]} is plotted in red and shows the instantaneous phase on [-\pi, \pi]. The angle shows a perceived rotation in the counter-clockwise direction which is a positive frequency. The complex sinusoid takes 8 samples to go one full rotation around the unit circle therefore the perceived frequency is f/f_s = 1/8 = 0.125.

Figure 2: The complex sinusoid x0[n] = e(j2 pi 0.125 n) plotted in the complex plane.
Figure 2: The complex sinusoid x0[n] = e(j2 pi 0.125 n) plotted in the complex plane.

Figure 3 shows the complex sinusoid x_{1}[n] = e^{j2\pi 0.25n} for n=0 to n=7. The angle shows a positive frequency the complex vector appears to be rotating in the counter-clockwise direction. The complex sinusoid takes 4 samples to go one full rotation around the unit circle therefore the perceived frequency is f/f_s = 1/4 = 0.25.

Figure 3: The complex sinusoid x1[n] = e(j2 pi 0.25 n) plotted in the complex plane.
Figure 3: The complex sinusoid x1[n] = e(j2 pi 0.25 n) plotted in the complex plane.

Figure 4 shows the complex sinusoid x_{2}[n] = e^{j2\pi 0.5n} for n=0 to n=7. The angle is a special case in that it alternates between 0 and \pm \pi which can be considered rotation in the clockwise direction or counter-clockwise direction. The complex sinusoid takes 2 samples to go one full rotation around the unit circle therefore the perceived frequency is f/f_s = \pm 1/2 = \pm 0.5.

Figure 4: The complex sinusoid x2[n] = e(j2 pi 0.5 n) plotted in the complex plane.
Figure 4: The complex sinusoid x2[n] = e(j2 pi 0.5 n) plotted in the complex plane.
 

Figure 5 shows the complex sinusoid x_{3}[n] = e^{j2\pi 0.75n} for n=0 to n=7. The angle is rotating in a clockwise direction and the complex sinusoid takes 4 samples to go one full rotation around the unit circle therefore the perceived frequency is f/f_s = -1/4 = -0.25 although in reality it is f/f_s = 0.75. The aliased frequency can be represented by 2\pi 0.75 - 2\pi = -2\pi 0.25 radians which is the perceived frequency seen in Figure 5. The complex vector appearing to rotate in the opposite direction is the exact same effect as the car tire rotating in the opposite direction as in the YouTube video above.

Figure 5: The complex sinusoid x3[n] = e(j2 pi 0.75 n) plotted in the complex plane.
Figure 5: The complex sinusoid x3[n] = e(j2 pi 0.75 n) plotted in the complex plane.

Figure 6 shows the complex sinusoid x_{4}[n] = e^{j2\pi 0.875n} for n=0 to n=7. The angle is rotating in a clockwise direction and the complex sinusoid takes 8 samples to go one full rotation around the unit circle therefore the perceived frequency is f/f_s = -1/8 = -0.125 although in reality it is f/f_s = 0.875. The aliased frequency can be represented by 2\pi 0.875 - 2\pi = -2\pi 0.125 radians which is the perceived frequency seen in Figure 6. The complex vector seemingly rotating in a clockwise direction rather than the counter-clockwise direction is the exact same effect as the car tire appearing to rotate in the reverse direction as in the YouTube video above.

Figure 6: The complex sinusoid x4[n] = e(j2 pi 0.875 n) plotted in the complex plane.
Figure 6: The complex sinusoid x4[n] = e(j2 pi 0.875 n) plotted in the complex plane.

Nyquist Sampling Theorem

When 0 < f/f_s < 0.5 the actual frequency matches the perceived frequency, as in Figure 2 and Figure 3, and the complex sinusoid rotates around the unit circle in a counter-clockwise direction. Figure 4 shows an interesting phenomenon: the direction of the rotation around the unit circle cannot be stated to be either clockwise or counter-clockwise when f/f_s = 0.5. When

(6)   \begin{equation*}0.5 < f/f_s < 1\end{equation*}

the perceived frequency appears to be negative -0.5 < f/f_s -1 < 0 and the complex vector is rotating in a clockwise direction.

The Nyquist sampling theorem states that a signal can be perfectly reconstructed if it is sampled with frequency f_s which is greater than or equal to twice the largest frequency f_{max} in the signal [proakis2007, p.13]

(7)   \begin{equation*}f_{s} \ge 2f_{max}.\end{equation*}

Another way to state the Nuyquist sampling theorem is that no aliasing distortion will occur if the ratio of the largest frequency f_{max} in the signal to sampling frequency f_s is less than or equal to 1/2,

(8)   \begin{equation*}\frac{f}{f_{s}} \le \frac{1}{2}.\end{equation*}

Note that the ratio in (8) is the boundary upon which aliasing occurs which can be seen in Figure 1 through Figure 6. When 0 < f/f_s \le 0.5 the actual frequency and perceived frequency are the same, however when 0.5 < f/f_s < 1 the frequency is aliased or “folded” to frequency f/f_s - 1 [lyons2011, p.40].

Takeaway

Aliasing is a form of distortion and occurs when the Nyquist sampling rate f_s \ge 2f_{max} is not satisfied. Aliasing causes actual frequencies f/f_s to be folded into negative frequencies f/f_s - 1 causing distortion of the underlying signal. Maintaining the proper ratio of sample rate to signal bandwidth in each operation in your DSP system will avoid aliasing.

More blog posts on complex sinusoids:

Leave a Reply