DSP Algorithms for RF Systems

Trending

Buy the Book!

DSP for Beginners: Simple Explanations for Complex Numbers! The second edition includes a new chapter on complex sinusoids.

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.

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].

Conclusion

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

For everything there is a season, and a time for every matter under heaven. A time to cast away stones, and a time to gather stones together. A time to embrace, and a time to refrain from embracing. Ecclesiastes 3:1,5
The earth was without form and void, and darkness was over the face of the deep. And the Spirit of God was hovering over the face of the waters. Genesis 1:2
Behold, I am toward God as you are; I too was pinched off from a piece of clay. Job 33:6
Enter His gates with thanksgiving, and His courts with praise! Give thanks to Him; bless His name! Psalm 100:4
Lift up your hands to the holy place and bless the Lord! Psalm 134:2
Blessed is the man who trusts in the Lord, whose trust is the Lord. He is like a tree planted by water, that sends out its roots by the stream, and does not fear when heat comes, for its leaves remain green, and is not anxious in the year of drought, for it does not cease to bear fruit. Jeremiah 17:7-8
He said to him, “You shall love the Lord your God with all your heart and with all your soul and with all your mind. This is the great and first commandment. And a second is like it: You shall love your neighbor as yourself. On these two commandments depend all the Law and the Prophets.” Matthew 22:37-39
Then He said to me, “Prophesy over these bones, and say to them, O dry bones, hear the word of the Lord. Thus says the Lord God to these bones: Behold, I will cause breath to enter you, and you shall live." Ezekiel 37:4-5
Riches do not profit in the day of wrath, but righteousness delivers from death. Proverbs 11:4
The angel of the Lord appeared to him in a flame of fire out of the midst of a bush. He looked, and behold, the bush was burning, yet it was not consumed. And Moses said, “I will turn aside to see this great sight, why the bush is not burned.” When the Lord saw that he turned aside to see, God called to him out of the bush, “Moses, Moses!” And he said, “Here I am.” Exodus 3:2-3
Daniel answered and said: “Blessed be the name of God forever and ever, to whom belong wisdom and might. He changes times and seasons; He removes kings and sets up kings; He gives wisdom to the wise and knowledge to those who have understanding." Daniel 2:20-21
Now the Lord is the Spirit, and where the Spirit of the Lord is, there is freedom. 2 Corinthians 3:17
Previous slide
Next slide

This website participates in the Amazon Associates program. As an Amazon Associate I earn from qualifying purchases.

© 2021-2024 Wave Walker DSP