# 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 $V=e^{j\theta}$ in an $IQ$ plane is a constant number. Let’s investigate how it changes with time.

## A complex signal

Imagine the same complex number $V=e^{j\theta}$ rotating counterclockwise in a circle at a constant rate with time as drawn in the figure below. The constant $V$ now becomes a function of time $V(t)$ with the time axis in a direction and appears to be coming out of the screen.

- The complex number $V$ has now become a complex signal $V(t)$ with time as independent variable. This signal is known as a
**complex sinusoid**. - The change in phase $\Delta \theta$ during an interval $\Delta t$ is a constant known as the
**angular velocity**.

$\begin{equation*} \textmd{angular velocity} =\omega= \frac{\Delta\theta}{\Delta t} \end{equation*}$

Let’s explore the real and imaginary parts of this signal.

## Inphase and quadrature components

For a complex number $V=e^{j\theta}$, the real and imaginary components are $\cos \theta$ and $\sin\theta$.

- The projection on x-axis is $\cos \theta$.
- The projection on y-axis is $\sin \theta$.

The signal, $V(t)$ is shown in the figure above and appears to be coming out of the screen.

- Its projection from a $3$-dimensional plane to a $2$-dimensional plane downwards gives the real or $I$ part:

$V_I(t)= \cos 2\pi F t$

- The projection from a $3$-dimensional plane to a $2$-dimensional plane on the side gives the imaginary or $Q$ part:

$V_Q(t)= \sin 2\pi F t$

The $I$ part is known as the **inphase component** and the $Q$ part is known as the **quadrature component**. This is due to the convention of choosing $\cos(\cdot)$ as our reference sinusoid and that $\sin(\cdot)$ is in quadrature – i.e., $90^ \circ$ apart with $\cos(\cdot)$.

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:

$\begin{equation*} V(t) = e^{j\omega t}=e^{j2\pi F t} \end{equation*}$

Using the fact that quadrature is the perpendicular direction and $j$ is a rotation by $90^\circ$, this can also be written as:

$\begin{equation*} e^{j2\pi F t} = \cos {2\pi F t} + j\sin {2\pi F t} \end{equation*}$

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 $2.4\times10^9$ Hz, which means that the oscillator frequency is $2,400,000,000$ cycles per second. The period of a wave like this is:

$\frac{1}{2,400,000,000}=0.42 \text{~ns}$

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.