DSP Algorithms for RF Systems

Buy the Book!

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

Phase, Frequency and Negative Frequency in Complex Sinusoids
October 19, 2021

Table of Contents

Introduction

A prior post described how sinusoids came to be used in DSP and RF due to physical properties of the universe. A follow up gave some mathematical rules about complex sinusoids on how sine, cosine and e^{j\phi} all related to one another in terms of Euler’s triangle. This blog will continue by including time in complex sinusoids, describe how phase and frequency relate to one another, how a negative frequency arises and demonstrates the concepts using the unit circle. It may be useful to review some complex math before jumping into this post.

Additional blog posts on complex numbers:

Instantaneous Phase

Euler’s formula

(1)   \begin{equation*}e^{j \phi} = cos(\phi) + j \cdot sin (\phi)\end{equation*}

is used to describe the position of a vector on the unit circle in the complex plane as shown in Figure 1.

Figure 1: Sine and cosine refer to the opposite and adjacent lengths of a triangle with angle phi. Euler's formula is used to relate the sine and cosine within a triangle.
Figure 1: Euler's formula relates sine and cosine in the complex plane and their relative position on the unit circle.

Similarly Euler’s formula can be given as

(2)   \begin{equation*}e^{j \omega n} = \text{cos}(\omega n) + j\cdot \text{sin}(\omega n)\end{equation*}

which describes a complex sinusoid rotating around the unit circle with time n. An example of a complex sinusoid e^{j 2\pi n/8} is given in Figure 2. The complex sinusoid can be created in Python by

import numpy as np
n = np.arange(0,8)
complexSinusoid = np.exp(2j*np.pi*n/8)

Figure 2: The complex sinusoid e(j2 pi n/8) for n = 0, 1, 2, ..., 7.
Figure 2: The complex sinusoid e(j2 pi n/8) for n = 0, 1, 2, ..., 7.

The instantaneous phase of a complex sinusoid is the angle from 0 radians in the complex plane at some time n. For

(3)   \begin{equation*}x[n] = e^{j\omega n}\end{equation*}

the instantaneous phase is given by

(4)   \begin{equation*}\sphericalangle{x[n]} = \sphericalangle{e^{j\omega n}} = \omega n.\end{equation*}

As the complex sinusoid rotates through the unit circle the instantaneous phase will change with time n. From the example in Figure 2 the complex sinusoid is e^{j 2\pi n /8} such that the instantaneous phase is

(5)   \begin{equation*}\sphericalangle{e^{j2\pi n/8}} = 2\pi n/8.\end{equation*}

From (5), the instantaneous phase is

(6)   \begin{equation*}\begin{split}\sphericalangle{x[0]} & = e^{j 0} = 0, \\\sphericalangle{x[1]} & = e^{j 2\pi/8} = 2\pi/8 = pi/4, \\\sphericalangle{x[2]} & = e^{j 4\pi/8} = 4\pi/8 = \pi/2 \\\end{split}\end{equation*}

which can be seen in Figure 2.

Instantaneous Frequency

Where the instantaneous phase is the phase of a complex sinusoid at time n the instantaneous frequency is the velocity at which the complex sinusoid is rotating through the unit circle at time n.

From the example complex sinusoid e^{j 2\pi n/8} in Figure 2 the instantaneous phase moves by 2\pi/8 for each time n. The frequency in this case is therefore 2\pi/8 because it describes the velocity at which the complex sinusoid is rotating through the unit circle.

It can also be stated that the instantaneous frequency is the time-derivative of the instantaneous phase

(7)   \begin{equation*}\begin{split}\frac{d}{dn} \sphericalangle{x[n]} & = \frac{d}{dn} \sphericalangle{e^{j \omega n}} \\& = \frac{d}{dn} \omega n \\& = \omega,\end{split}\end{equation*}

or the instantaneous phase is the integral of the instantaneous frequency

(8)   \begin{equation*}\sphericalangle{x[n]} = \sum_{k=0}^{n-1} \omega = \omega n.\end{equation*}

Figure 3 gives an example of the instantaneous phase for e^{j2\pi n/8}. The unwrapped phase is (8) which has unbounded phase values and the wrapped phase applies the modulo operator to keep all values within [-\pi, \pi]. Note that the instantaneous frequency is the derivative of the unwrapped phase which is 2\pi/8 in this case. The instantaneous phase can be calculated from the sinusoid by

instPhase = np.angle(complexSinusoid)

and wrapping the phase by

instPhaseUnwrap = np.unwrap(instPhase)

Figure 3: The unwrapped and unwrapped phase for e(j2 pi n/8). The wrapped phase applies a modulo operator to keep all phase values within [-pi, pi].
Figure 3: The unwrapped and unwrapped phase for e(j2 pi n/8). The wrapped phase applies a modulo operator to keep all phase values within [-pi, pi].

Figure 4 is the time-domain plot for e^{j2\pi n/8}.

Figure 4: The time-domain plot of e(j2 pi n/8) for n=0 to n=31.
Figure 4: The time-domain plot of e(j2 pi n/8) for n=0 to n=31.

Negative Frequency

The trap in thinking about frequency is that it represents how often something happens, which is tricky because it is partially true. An incomplete definition of frequency would be how quickly a complex sinusoid rotates through the unit circle. The correct way to think about frequency it is is the speed and direction a complex sinusoid is rotating around the unit circle.

The complex sinusoid e^{j2\pi n/8} has an instantaneous frequency of 2\pi/8 which is the speed of the rotation around the unit circle in a counter-clockwise direction as in Figure 2. The complex sinusoid e^{-j2 \pi n/8} has an instantaneous frequency of -2\pi/8 which is the speed of rotation the unit circle in a clockwise direction as in Figure 5.

Figure 5: The complex sinusoid e(-j2 pi n/8) has a negative frequency and thus rotates around the unit circle in a clockwise direction.
Figure 5: The complex sinusoid e(-j2 pi n/8) has a negative frequency and thus rotates around the unit circle in a clockwise direction.

Figure 6 is a plot of the instantaneous phase for e^{-j2\pi n/8} which shows a negative slope of the unwrapped phase, -2\pi/8, because the frequency is negative. Compare against the positive slope in Figure 3.

Figure 6: The unwrapped and wrapped phase for e(-j2 pi n/8). Note that the phase has a negative slope because the frequency is negative.
Figure 6: The unwrapped and wrapped phase for e(-j2 pi n/8). Note that the phase has a negative slope because the frequency is negative.

Figure 7 gives a time-domain plot for e^{-j 2\pi n/8} which shows that a negative frequency changes the phase relationship between the \cos(\cdot) and \sin(\cdot) elements as compared to Figure 4. Where the real element \cos(\cdot) leads the imaginary element \sin(\cdot) for a positive frequency complex sinusoid, the reverse is true for a negative frequency complex sinusoid.

Figure 7: The time-domain for e(-j2 pi n/8). Observe that the phase relationship between cos() and sin() is different as compared to Figure 2.
Figure 7: The time-domain for e(-j2 pi n/8). Observe that the phase relationship between cos() and sin() is different as compared to Figure 2.

Phase Offset

It’s important to draw the distinction between instantaneous phase and phase offset since the two are related but differ. For a complex vector

(9)   \begin{equation*}e^{j(\omega n + \theta)}\end{equation*}

the instantaneous phase is the angle at time n,

(10)   \begin{equation*}\sphericalangle{e^{j(\omega n + \theta)}} = \omega n + \theta\end{equation*}

where the phase offset is \theta. The phase offset can be summarized as the instantaneous phase at time n=0.

Conclusion

The instantaneous phase and frequency of a complex sinusoid are directly related to one another and understanding the relationship is important before moving onto more sophisticated DSP algorithms. The relationship can be summarized as the instantaneous phase is the integral of the instantaneous frequency and the instantaneous frequency is the derivative of the instantaneous phase.

A complex sinusoid can have a positive or negative frequency. A positive frequency is rotation around the unit circle in a counter-clockwise direction where as a negative frequency is rotation in a clockwise direction. Additionally, a positive frequency complex sinusoid will have the real element lead the imaginary element in the time domain, but the reverse is true for a negative frequency complex sinusoid.

Don’t forget to check out these other blog posts on complex numbers!

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