Complex Sinusoids: The Doorway to DSP
Understand how complex sinusoids (the fundamental signals in DSP applications) are constructed in software.
We'll cover the following
From our knowledge of complex representation, we know that a complex number in an plane is a constant number. Let’s investigate how it changes with time.
A complex signal
Imagine the same complex number rotating counterclockwise in a circle at a constant rate with time as drawn in the figure below. The constant now becomes a function of time with the time axis in a direction and appears to be coming out of the screen.
- The complex number has now become a complex signal with time as independent variable. This signal is known as a complex sinusoid.
- The change in phase during an interval is a constant known as the angular velocity.
Let’s explore the real and imaginary parts of this signal.
Inphase and quadrature components
For a complex number , the real and imaginary components are and .
- The projection on x-axis is .
- The projection on y-axis is .
The signal, is shown in the figure above and appears to be coming out of the screen.
- Its projection from a -dimensional plane to a -dimensional plane downwards gives the real or part:
- The projection from a -dimensional plane to a -dimensional plane on the side gives the imaginary or part:
The part is known as the inphase component and the part is known as the quadrature component. This is due to the convention of choosing as our reference sinusoid and that is in quadrature – i.e., apart with .
Let’s explore this further with the help of some code.
from mpl_toolkits import mplot3dimport numpy as npimport matplotlib.pyplot as plfigWidth = 20figHeight = 10f = 1.4A = 0.8t = np.arange(0, 2.8, 0.01)iwave = A*np.cos(2*np.pi*f*t)qwave = A*np.sin(2*np.pi*f*t)# Plottingfig = pl.figure(1, figsize=(figWidth,figHeight), constrained_layout=True)ax = pl.axes(projection='3d')ax.plot3D(t, iwave, qwave, linewidth=2, color='b')ax.plot3D(t, iwave, -2*np.ones(len(qwave)), color='r')ax.plot3D(t, 2*np.ones(len(iwave)), qwave, color='r')ax.xaxis.set_ticklabels([])ax.yaxis.set_ticklabels([])ax.zaxis.set_ticklabels([])ax.set_xlim(t[0], t[-1])ax.set_xticks(np.arange(t[0], t[-1], 0.5))ax.set_ylim(-2, 2)ax.set_yticks(np.arange(-2, 2, 1))ax.set_zlim(-2, 2)ax.set_zticks(np.arange(-2, 2, 1))ax.tick_params(labelsize=18)ax.text(0, 0.5, 1, '$V(t)$', fontsize=18)ax.text(1.5, -3.5, -0.5, '$V_I(t)=\cos (2\pi ft)$', fontsize=18)ax.text(1.5, 0.6, 2, '$V_Q(t)=\sin(2\pi ft)$', fontsize=18)# Hide the right and top spinesax.spines['right'].set_visible(False)ax.spines['top'].set_visible(False)ax.set_xlabel("Time", fontsize=18)ax.set_ylabel("I", fontsize=18)ax.set_zlabel("Q", fontsize=18)ax.grid()pl.savefig('output/complex-sinusoid.png', bbox_inches='tight')
In complex notation, this complex sinusoid is given as:
Using the fact that quadrature is the perpendicular direction and is a rotation by , this can also be written as:
This is known as Euler’s identity.
Example
When you turn on a microwave on to heat food, it transmits waves at a frequency of Hz, which means that the oscillator frequency is cycles per second. The period of a wave like this is:
While this electromagnetic wave is real, a complex sinusoid incorporates the phase information in a convenient manner for signal processing. We will see later that complex sinusoids can act as a doorway to understanding signals and DSP operations.