Discrete Signal Processing (DSP):

Discrete Signals

Table of Contents





1. Discrete Time Signals

A discrete-time signal is a function defined over an integer-valued independent variable. We denote such a signal as:


$$ x[n] : \mathbb{Z} \rightarrow \mathbb{R} \ \text{or} \ \mathbb{C} $$

That is, the independent variable $n$ takes values in the set of integers $\mathbb{Z}$, and the signal value $x[n]$ is a real or complex number.



1.1. Plotting Real Signals

In MATLAB, different functions are used to visualize continuous-time and discrete-time signals:

  • Continuous-Time Signals: Use the plot function to display continuous waveforms. This function connects data points with lines to approximate the appearance of a continuous signal.

  • Discrete-Time Signals: Use the stem function to display discrete signals. This function emphasizes the fact that the signal is only defined at integer time indices.


MATLAB Code


$$x(t) = \sin(2\pi t)$$
In [ ]:
%plot -s 560,200

t = 0:0.01:2;
x = sin(2*pi*t);

plot(t, x, 'linewidth', 2);
ylim([-1.1 1.1]);
xlabel('t [sec]');
ylabel('x(t)');



$$x[n] = \sin \left(\frac{2 \pi}{N}n \right)$$
In [ ]:
%plot -s 560,400

N = 20;
n = 0:N-1;
x = sin(2*pi/N*n);

subplot(2,1,1)
plot(n,x,'o'), axis tight, ylim([-1.2, 1.2])
subplot(2,1,2)
stem(n,x,'filled'), axis tight, ylim([-1.2, 1.2])




2. Signal Properties

2.1. Finite- and Infinite-Length Signals

A discrete-time signal $x[n]$ may be either finite-length or infinite-length depending on its domain of definition:

  • A signal is said to be of infinite length if it is defined for all integers:

$$ x[n], \quad n \in \mathbb{Z} $$

  • A signal is said to be of finite length if it is defined only on a finite interval:

$$ x[n], \quad N_1 \leq n \leq N_2 $$

In practice, most physical signals are of finite duration, although infinite-length signals are often used in theory and analysis.



2.2. Periodic Signals

A discrete-time signal $x[n]$ is said to be periodic with period $N \in \mathbb{Z}^+$ if it satisfies the following condition for all $n \in \mathbb{Z}$ and all integers $m$:


$$ x[n + mN] = x[n] $$

That is, the signal repeats itself every $N$ samples. Note the following important points:

  • The period $N$ must be a positive integer
  • A periodic signal is necessarily infinite in length
  • If a signal is periodic, its entire structure is determined by a single period

Infinite-length and finite-length signals can be converted into one another through windowing and extension:


Windowing (Truncation): An infinite-length signal $x[n]$ can be truncated to a finite-length signal $y[n]$ as follows:


$$ y[n] = \begin{cases} x[n], & N_1 \leq n \leq N_2 \\ 0, & \text{otherwise} \end{cases} $$

Extension by Zero-Padding: A finite-length signal can be extended to infinite length by zero-padding:


$$ y[n] = \begin{cases} 0, & n < N_1 \\ x[n], & N_1 \leq n \leq N_2 \\ 0, & n > N_2 \end{cases} $$

Extension by Periodization: Alternatively, a finite-length signal can be periodically extended to infinite length:


$$ \begin{align*} y[n] &= \sum_{m = -\infty}^{\infty} x[n - mN] \\ &=\cdots + x[n+N] + x[n] + x[n-N]+ \cdots \end{align*} $$

This operation is referred to as periodization and is central to the analysis of discrete Fourier transforms.




2.3. Modular Arithmetic and Periodic Indexing

Modular Arithmetic

Modular arithmetic with modulus $N$ effectively wraps the number line into a circular structure with $N$ distinct values:


$$ \cdots = (-12)_8 = (-4)_8 = 4 = 12 = 20 = \cdots $$

This arithmetic is inherently periodic and forms the basis for circular operations on signals.



Periodization Using Modular Indexing

Let $x[n]$ be defined for $0 \leq n < N$. Then the periodic extension of $x[n]$ with period $N$ can be written compactly as:


$$ y[n] = x[(n)_N] $$

This expresses the idea that periodic signals live on a circle, in contrast to infinite-length signals which live on the infinite integer line.


In [ ]:
%plot -s 560,100

N = 8;
n = 0:N-1;
x = [0 1 2 3 4 3 2 1];

stem(n,x,'filled');
xlabel('n'), ylabel('x[n]')
xlim([-16,23]),
yticks([0,4])
box('off')

In [ ]:
%plot -s 560,100

%% periodic using mod
y = [];
n = -16:23;

for i = 1:length(n)
    y(i) = x(mod(n(i),N)+1);
end

stem(n,y,'filled'), axis tight
xlabel('n'), ylabel('y[n]')
yticks([0,4])
box('off')



2.4. Finite-Length vs. Periodic Signals

Finite-length and periodic signals are conceptually distinct, yet closely related:

  • Every periodic signal is infinite in length, but contains only $N$ unique samples
  • Every finite-length signal can be extended periodically
  • Thus, in many contexts, we can treat finite-length and periodic signals interchangeably


Shifting Infinite-Length Signals

Given an infinite-length signal $x[n]$, a shift by $m$ samples is defined as:


$$ x[n - m] $$
  • If $m > 0$, this corresponds to a right shift (delay)
  • If $m < 0$, this corresponds to a left shift (advance)



Shifting Periodic Signals

For a periodic signal $x[n]$ with period $N$, the shift operation must use modular arithmetic:


$$ y[n] = x[(n - m)_N] $$

This is known as a circular shift by $m$ samples.



Shifting Finite-Length Signals

Consider two finite-length signals $x[n]$ and $y[n]$ defined for $0 \leq n < N$, and define:


$$ y[n] = x[n - 1] $$

This operation leads to ambiguity at the boundaries:


$$ \begin{aligned} y[0] &= \;? \\ y[1] &= x[0] \\ y[2] &= x[1] \\\\ &\vdots \\\\ y[N-1] &= x[N-2] \\ \;? &= x[N-1] \end{aligned} $$

To avoid information loss or invention, we assume that both signals are periodic with period $N$, leading to:


$$ y[n] = x[(n - 1)_N] $$

This defines a circular shift in the finite-length context.


Circular Time Reversal

For a periodic signal $x[n]$ of period $N$, the circular time reversal is defined as:


$$ y[n] = x[(-n)_N] $$

For example, with $N = 8$, the reversal yields:


$$ \begin{aligned} y[0] &= x[0] \\ y[1] &= x[7] \\ y[2] &= x[6] \\ y[3] &= x[5] \\ y[4] &= x[4] \\ y[5] &= x[3] \\ y[6] &= x[2] \\ y[7] &= x[1] \end{aligned} $$

This operation mirrors the signal around index $n = 0$ on a periodic domain.





3. Key Discrete Signals

This section introduces fundamental discrete-time signals that are widely used in analysis, modeling, and implementation of digital systems.


3.1. Delta Function (aks Unit Impulse)


The unit impulse or delta function is defined as:


$$\delta[n] = \begin{cases}1 & n=0\\ 0 &\text{otherwise}\end{cases}$$

  • A shifted delta function $\delta[n - m]$ equals 1 at $n = m$ and 0 elsewhere


(MATLAB)

Delta function: $\delta[n]$


$$x[n]=\delta[n-n_0] \quad n_1 \leq n \leq n_2$$

impseq(n0,n1,n2):

function [x,n] = impseq(n0,n1,n2)

% Generates x(n) = delta(n-n0); n1 <= n,n0 <= n2
% [x,n] = impseq(n0,n1,n2)

if ((n0 < n1) | (n0 > n2) | (n1 > n2))
    error('arguments must satisfy n1 <= n0 <= n2')
end

n = [n1:n2];
% x = [zeros(1,(n0-n1)), 1, zeros(1,(n2-n0))];
x = [(n-n0) == 0];

The delta function acts as a sampling operator. It isolates individual values from a signal.


Sampling Property:

Let $x[n]$ be a discrete-time signal. Then:


$$ y[n] = x[n] \delta[n - m] = x[m] \delta[n - m] $$

This identity expresses a fundamental property:

  • The product $x[n] \delta[n - m]$ is nonzero only when $n = m$.

  • At $n = m$, the value of the output is $x[m]$.

  • Here, $x[m]$ is a constant scalar, and not a function of $n$.

This operation effectively picks out the value of $x[n]$ at index $n = m$ while setting all other values to zero.



MATLAB code: A signal composed of delta functions:


$$x[n] = 2\delta[n+2] - \delta[n-4]$$
In [ ]:
%plot -s 560,400

% delta function

n = [-5:5];
x1 = impseq(0,-5,5);
x2 = 2*impseq(-2,-5,5)-impseq(4,-5,5);

subplot(2,1,1), stem(n,x1,'filled'), axis([-5,5,-1.5,2.5]), ylabel('x_1[n]');
subplot(2,1,2), stem(n,x2,'filled'), axis([-5,5,-1.5,2.5]), xlabel('n'), ylabel('x_2[n]');


3.2. Unit Step Function

The unit step function is defined as:


$$ u[n] = \begin{cases} 1, & n \geq 0 \\ 0, & n < 0 \end{cases} $$



  • The shifted step function $u[n - m]$ makes a step from 0 to 1 at $n = m$
  • The step function is often used to construct piecewise-defined or time-limited signals


Gating a Signal:

The product of a signal and a unit step function truncates part of the signal:


$$ y[n] = x[n] u[n - m] $$

This sets all values of $x[n]$ to zero for $n < m$



(MATLAB)

Step function: $u[n]$


$$x[n]=u[n-n_0] \quad n_1 \leq n \leq n_2$$

stepseq(n0,n1,n2):

function [x,n] = stepseq(n0,n1,n2)
% Generates x(n) = u(n-n0); n1 <= n,n0 <= n2
% [x,n] = stepseq(n0,n1,n2)

if ((n0 < n1) | (n0 > n2) | (n1 > n2))
    error('arguments must satisfy n1 <= n0 <= n2')
end

n = [n1:n2];
% x = [zeros(1,(n0-n1)), ones(1,(n2-n0+1))];
x = [(n-n0) >= 0];

Examples:

  • A finite rectangular pulse:

$$ x_1[n] = u[n] - u[n - 10] $$
  • A decaying exponential starting at $n = 0$:

$$ x_2[n] = 0.9^n \, u[n] $$
In [ ]:
%plot -s 560,400

% step function

n = -5:30;
x1 = stepseq(0,-5,30) - stepseq(10,-5,30);

x2 = 0.9.^n.*stepseq(0,-5,30);

subplot(2,1,1), stem(n,x1,'filled'), axis tight, ylim([-0.1, 1.1]), yticks([0,1]), ylabel('x_1[n]')
subplot(2,1,2), stem(n,x2,'filled'), axis tight, ylim([-0.1, 1.1]), yticks([0,1]), ylabel('x_2[n]')


3.3 Real Exponential Signals

A real exponential signal is defined as:


$$ x[n] = a^n, \quad n \in \mathbb{Z} $$

The shape of the signal depends on the value of $a$:


  • If $a > 1$: the signal grows exponentially to the right


  • If $0 < a < 1$: the signal decays exponentially



3.4. Sinusoid Signals

Discrete-time sinusoids are typically of the form:


$$ x[n] = \cos(\omega n + \phi) \quad \text{or} \quad x[n] = \sin(\omega n + \phi) $$

where:

  • $\omega$ is the angular frequency, measured in radians/sample
  • $\phi$ is the phase, measured in radians



Example

  • $\cos (\omega n)$


  • $\sin (\omega n)$


3.4.1 Frequency of a Sinusoid

The frequency $\omega$ controls the rate of oscillation:

  • $\omega = 0$ leads to a constant signal: $\cos(0 \cdot n) = 1$
  • Larger values of $\omega$ correspond to faster oscillations
  • The signal is periodic if $\omega / 2\pi$ is rational



Example:

  • $\cos (0 n)$


  • $\cos \left(\frac{2\pi}{10} n \right)$


  • $\cos \left(\frac{4\pi}{10} n \right)$


  • $\cos \left(\frac{6\pi}{10} n \right)$


  • $\cos \left(\frac{10\pi}{10} n \right)=\cos(\pi n)$


3.4.2 Phase of a Sinusoid

The phase $\phi$ introduces a horizontal shift in the sinusoid

  • It offsets the waveform relative to $n = 0$
  • It is independent of frequency

Example

  • $\cos \left( \frac{2\pi}{10}\right)$


  • $\cos \left( \frac{2\pi}{10} - \frac{\pi}{2}\right)$


  • $\cos \left( \frac{2\pi}{10} - \frac{2\pi}{2}\right)$


  • $\cos \left( \frac{2\pi}{10} - \frac{3\pi}{2}\right)$


  • $\cos \left( \frac{2\pi}{10} - \frac{4\pi}{2}\right) = \cos \left( \frac{2\pi}{10}\right)$




4. Discrete Signal Synthesis

4.1. Key Functions for Signal Synthesis

The following functions are commonly used to manipulate discrete-time signals in a modular and reusable way:


sigshift(x, m, n0)

Time-shifts the signal $x[n]$ by $n_0$ samples


$$ y[n] = x[n - n_0] $$

Input:

  • x: Signal samples

  • m: Time indices corresponding to x

  • n0: Shift amount (positive for delay, negative for advance)

Output: Shifted signal and its new time indices


function [y,n] = sigshift(x,m,n0)
% implements y(n) = x(n-n0)
% [y,n] = sigshift(x,m,n0)

n = m + n0;
y = x;

sigfold(x, n)


$$ y[n] = x[-n] $$

This operation reflects the signal about the vertical axis at $n = 0$.


function [y, n_folded] = sigfold(x, n)
%SIGFOLD  Time-reverses a discrete-time signal
%   [y, n_folded] = sigfold(x, n) reflects the signal x(n) about n = 0
%   such that y(n) = x(-n)
%
%   Inputs:
%     x  - input signal vector
%     n  - time index vector corresponding to x
%
%   Outputs:
%     y         - time-reversed signal
%     n_folded  - time index vector for y

y = fliplr(x);           % reverse signal values
n_folded = -fliplr(n);   % reverse and negate time indices
end

sigadd(x1, n1, x2, n2)


$$y[n] = x_1[n] + x_2[n]$$
  • Works even when signals are defined over different ranges.

  • Properly aligns the signals to a common index vector before summing.


function [y, n] = sigadd(x1, n1, x2, n2)
%SIGADD  Adds two discrete-time signals with possibly different index ranges
%
%   [y, n] = sigadd(x1, n1, x2, n2) computes the sum y(n) = x1(n) + x2(n)
%   over the union of the index ranges n1 and n2.
%
%   Inputs:
%     x1, n1 - first signal and its time indices
%     x2, n2 - second signal and its time indices
%
%   Outputs:
%     y      - resulting summed signal
%     n      - time index vector corresponding to y

% Determine the full range of output indices
n_start = min([min(n1), min(n2)]);
n_end   = max([max(n1), max(n2)]);
n = n_start:n_end;

% Initialize zero-padded signals
y1 = zeros(1, length(n));
y2 = zeros(1, length(n));

y1(find((n >= min(n1)) & (n <= max(n1)) == 1)) = x1;     % x1 with duration of y
y2(find((n >= min(n2)) & (n <= max(n2)) == 1)) = x2;     % x2 with duration of y

y = y1 + y2;                                             % sequence addition

sigmult(x1, n1, x2, n2)


$$y[n] = x_1[n] \cdot x_2[n]$$

where the two signals are first aligned to a common time index vector, zero-padded if needed, and then multiplied element by element.


function [y, n] = sigmult(x1, n1, x2, n2)
%SIGMULT  Multiplies two discrete-time signals with possibly different index ranges
%
%   [y, n] = sigmult(x1, n1, x2, n2) computes the pointwise product
%   y(n) = x1(n) * x2(n) over the union of the index ranges n1 and n2.
%
%   Inputs:
%     x1, n1 - first signal and its time indices
%     x2, n2 - second signal and its time indices
%
%   Outputs:
%     y      - resulting product signal
%     n      - time index vector corresponding to y

% Define the full range of time indices
n_start = min([min(n1), min(n2)]);
n_end   = max([max(n1), max(n2)]);
n = n_start:n_end;

% Initialize zero-padded signals
y1 = zeros(1, length(n));
y2 = zeros(1, length(n));

y1(find(( n>= min(n1)) & (n <= max(n1)) == 1)) = x1;     % x1 with duration of y
y2(find(( n>= min(n2)) & (n <= max(n2)) == 1)) = x2;     % x2 with duration of y

y = y1 .* y2;                                            % sequence multiplication

(MATLAB) Example


$$ \begin{align*} x[n]=\{1,2,&\;3,4,5,6,7,6,5,4,3,2,1\}\\ &\uparrow \end{align*} $$
$$x_1[n]=2x[n-5]-3x[n+4]$$
In [ ]:
%plot -s 560,400

n = -2:10;
x = [1:7,6:-1:1];

[x11,n11] = sigshift(x,n,5);
[x12,n12] = sigshift(x,n,-4);
[x1,n1] = sigadd(2*x11,n11,-3*x12,n12);

subplot(2,1,1), stem(n,x,'filled'), xlim([-6,15]), ylim([-21,14])
subplot(2,1,2), stem(n1,x1,'filled'), axis tight
xlabel('n'), ylabel('x_1(n)')


(MATLAB) Example


$$\begin{align*} x[n]=\{1,2,&\;3,4,5,6,7,6,5,4,3,2,1\}\\ &\uparrow \end{align*}$$
$$x_2[n]=x[3-n]+x[n]x[n-2]$$
In [ ]:
%plot -s 560,200

[x21,n21] = sigfold(x,n);
[x21,n21] = sigshift(x21,n21,3);

[x22,n22] = sigshift(x,n,2);
[x22,n22] = sigmult(x,n,x22,n22);

[x2,n2] = sigadd(x21,n21,x22,n22);

stem(n2,x2,'filled'), axis tight
xlabel('n'), ylabel('x_2(n)')



4.2. Understanding Time Reversal and Shifting

In discrete-time signal processing, time-reversal and shifting are two fundamental operations. Combinations like $x[-n + k]$ can be understood by decomposing the operations step-by-step.


Original Signal

Let the signal $x[n]$ be defined as:


$$ \begin{align*} x[n] = \{ & 0,\; 1,\; 2,\; 3,\; 0,\; 0,\; 0 \} \\ & \uparrow \\ & n = 0 \end{align*} $$

This means:

  • $x[0] = 0$
  • $x[1] = 1$, $x[2] = 2$, $x[3] = 3$, and so on.

In [ ]:
%plot -s 560,200

N = 7;
x = [0 1 2 3 0 0 0];
n = 0:N-1;

stem(n,x,'filled')


Time Reversal


$$x_1[n] = x[-n]$$

This operation reflects the signal around $n = 0$. The time indices are reversed:

  • $x[0] \to x_1[0]$, $x[1] \to x_1[-1]$, $x[2] \to x_1[-2]$, etc.

In [ ]:
%plot -s 560,400
[x1,n1] = sigfold(x,n);

subplot(2,1,1), stem(n,x,'filled')
ylabel('x[n]'), axis([-6.5 6.5 -1 4])
subplot(2,1,2), stem(n1,x1,'filled')
ylabel('x[-n]'), axis([-6.5 6.5 -1 4])


Time Shift

This shifts the signal to the right by 2 samples (delay):


$$ x_2[n] = x[n - 2] $$
  • $x_2[2] = x[0]$, $x_2[3] = x[1]$, etc.

In [ ]:
%plot -s 560,400
[x2,n2] = sigshift(x,n,2);

subplot(2,1,1), stem(n,x,'filled')
ylabel('x[n]'), axis([-0.5 8.5 -1 4])
subplot(2,1,2), stem(n2,x2,'filled')
ylabel('x[n-2]'), axis([-0.5 8.5 -1 4])


Combined Reversal and Shift



(1) A right shift by $k$ followed by a time-reversal


$$x[n] \quad \rightarrow \quad x[n - k] \quad \rightarrow \quad x[-n-k]$$

(2) A time-reversal followed by a right shift by $k$


$$x[n] \quad \rightarrow \quad x[-n] \quad \rightarrow \quad x[-(n-k)] = x[-n + k]$$

(MATLAB) Example

In [ ]:
%plot -s 560,460

[x2,n2] = sigshift(x,n,2);
[x3,n3] = sigfold(x2,n2);

[x1,n1] = sigfold(x,n);
[x4,n4] = sigshift(x1,n1,2);

subplot(3,1,1), stem(n,x,'filled')
ylabel('x[n]'), axis([-8.5 8.5 -1 4])
subplot(3,1,2), stem(n3,x3,'filled')
ylabel('x_3[n]'), axis([-8.5 8.5 -1 4])
subplot(3,1,3), stem(n4,x4,'filled')
ylabel('x_4[n]'), axis([-8.5 8.5 -1 4])




5. Complex Sinusoids

5.1 Complex Numbers

A complex number can be expressed in rectangular form as:


$$ z_1 = a_1 + b_1 i, \qquad \vec{z}_1 = \begin{bmatrix} a_1 \\ b_1 \end{bmatrix} $$
$$ z_2 = a_2 + b_2 i, \qquad \vec{z}_2 = \begin{bmatrix} a_2 \\ b_2 \end{bmatrix} $$

Addition

Addition of complex numbers is performed component-wise:


$$ \begin{align*} z &= z_1 + z_2 = (a_1 + a_2) + (b_1 + b_2)i \\ \vec{z} &= \vec{z}_1 + \vec{z}_2 = \begin{bmatrix} a_1 + a_2 \\ b_1 + b_2 \end{bmatrix} \end{align*} $$

Multiplication and Division

When written in polar form, complex numbers take the form:


$$ \begin{cases} z_1 = r_1 e^{i\theta_1} \\ z_2 = r_2 e^{i\theta_2} \end{cases} $$

Their product and quotient are given by:


$$ \begin{cases} z_1 \cdot z_2 = r_1 r_2 e^{i(\theta_1 + \theta_2)} \\ \displaystyle \frac{z_1}{z_2} = \frac{r_1}{r_2} e^{i(\theta_1 - \theta_2)} \end{cases} $$

Euler’s Formula

A fundamental identity that connects exponential and trigonometric functions is Euler’s formula:


$$ e^{i\theta} = \cos\theta + i\sin\theta $$

Using Euler’s formula, any complex number can be expressed as:


$$ \begin{align*} \vec{z} &= r \cos\theta + i r \sin\theta \\ &= r (\cos\theta + i \sin\theta) \\ &= r e^{i\theta} \end{align*} $$

where:

  • $r$ is the magnitude or modulus
  • $\theta$ is the phase or argument


Signal Representations in $\mathbb{C}$

When the signal $x[n]$ is complex-valued ($x[n] \in \mathbb{C}$), it can be expressed in two equivalent forms:


  • Rectangular form:

    $$ x[n] = \text{Re}\{x[n]\} + j\,\text{Im}\{x[n]\} $$

  • Polar form:

    $$ x[n] = |x[n]| e^{j \angle x[n]} $$

These two views give complementary insights:

  • The rectangular form separates real and imaginary components
  • The polar form emphasizes amplitude and phase

Example for $e^{j \omega t}$



5.2. Geometric Interpretation of $e^{i\theta}$

The complex exponential $e^{i\theta}$ has a clear geometric meaning:


$$ e^{i\theta} = \cos\theta + i\sin\theta $$

This expression represents a point on the unit circle in the complex plane, located at an angle $\theta$ (radians) measured counterclockwise from the positive real axis.



Rotation in Time

Let $\theta = \omega t$, where $\omega$ is angular frequency (in radians per second) and $t$ is time. Then:


$$ e^{i\omega t} $$

represents a point that rotates counterclockwise on the unit circle with angular velocity $\omega$.



Direction of Rotation: $e^{-i\omega t}$

The negative exponent $e^{-i\omega t}$ has a similar form:


$$ e^{-i\omega t} = \cos(\omega t) - i\sin(\omega t) $$

This corresponds to clockwise rotation on the unit circle with angular velocity $\omega$.


If $\omega > 0$:

  • $e^{i\omega t}$ rotates counterclockwise
  • $e^{-i\omega t}$ rotates clockwise

Thus, the sign of $\omega$ determines both the speed and the direction of rotation.




5.3. Sinusoidal Functions from Circular Motion

A complex exponential traces out a helix in time. When plotted in the complex plane, the signal:


$$ x(t) = e^{i\omega t} $$

corresponds to a circular motion with constant angular velocity. The real and imaginary parts give sinusoidal signals:

  • $\text{Re}\{e^{i\omega t}\} = \cos(\omega t) \quad \rightarrow \quad$ projection onto the real axis
  • $\text{Im}\{e^{i\omega t}\} = \sin(\omega t) \quad \rightarrow \quad$ projection onto the imaginary axis




From Euler's formula, we can express real-valued sinusoids using complex exponentials:


$$ \cos(\omega t) = \frac{e^{i\omega t} + e^{-i\omega t}}{2} $$

Similarly:


$$ \sin(\omega t) = \frac{e^{i\omega t} - e^{-i\omega t}}{2i} $$

These identities allow us to express real signals as linear combinations of complex exponentials, which is fundamental in Fourier analysis.





6. Discrete Sinusoids

A discrete-time sinusoid is a function of the form:


$$x[n] = A \cos(\omega_0 n + \phi)$$

or equivalently,


$$x[n] = A e^{j (\omega_0 n + \phi)}$$

where:

  • $A$ is the amplitude
  • $\omega_0$ is the angular frequency (radians/sample)
  • $\phi$ is the initial phase

In many applications, the frequency is expressed as:


$$ \omega_0 = \frac{2\pi}{N}k $$

for some integer $k$, especially when working with signals of length $N$.


6.1. Aliasing of Sinusoids

Let us consider two complex sinusoids with different angular frequencies:


$$ \begin{align*} x_1[n] &= e^{j(\omega n + \phi)} \\ x_2[n] &= e^{j((\omega + 2\pi)n + \phi)} = e^{j(\omega n + \phi)} \cdot e^{j 2\pi n} \end{align*} $$

Note that $e^{j 2\pi n} = 1$ for all integer $n$. Therefore:


$$ x_2[n] = x_1[n] \quad \forall n \in \mathbb{Z} $$

Thus, even though $\omega$ and $\omega + 2\pi$ are different, the signals $x_1[n]$ and $x_2[n]$ are identical. This is called aliasing.


In [ ]:
% plot -s 560,400

N = 15;
n = 0:N-1;

x1 = cos(2*pi/N*n);
x2 = cos((2*pi/N + 2*pi)*n);

subplot(2,1,1), stem(n,x1,'filled'), yticks([-1,0,1]), ylabel('x_1[n]')
subplot(2,1,2), stem(n,x2,'filled'), yticks([-1,0,1])
xlabel('n'), ylabel('x_2[n]')


Alias-free frequencies

  • Aliasing occurs when different frequencies produce the same discrete-time signal
  • In discrete time, the complex exponential $e^{j\omega n}$ is $2\pi$-periodic in $\omega$

Therefore, we only need to consider a fundamental frequency interval of length $2\pi$


Common choices for the alias-free frequency interval:


$$ \begin{aligned} \text{(Unipolar)} \quad & 0 \leq \omega < 2\pi \\ \text{(Symmetric)} \quad & -\pi < \omega \leq \pi \end{aligned} $$

Any frequency outside this interval is an alias of one within it.


In [ ]:
%plot -s 560,600

N = 8;
n = 0:N-1;

xn1 = cos(pi*n);
xn2 = cos(3/2*pi*n);

t = 0:0.1:N-1;

x1 = cos(pi*t);
x2 = cos(3/2*pi*t);
x3 = cos(1/2*pi*t);

subplot(3,1,1),
stem(n,xn1,'filled'), hold on
plot(t,x1,'--','color',[0, 0.4470, 0.7410]), hold off
axis([0,7,-1.5 1.5])
ylabel('x_1[n]', 'fontsize', 12)

subplot(3,1,2),
stem(n,xn2,'filled'), hold on
plot(t,x2,'--','color',[0, 0.4470, 0.7410]), hold off
axis([0,7,-1.5 1.5])
ylabel('x_2[n]', 'fontsize', 12)

subplot(3,1,3),
stem(n,xn2,'filled'), hold on
plot(t,x2,'--','color',[0, 0.4470, 0.7410])
plot(t,x3,'color','r'), hold off
axis([0,7,-1.5 1.5])
ylabel('x_3[n]', 'fontsize', 12)



6.2. Low and High Frequencies

Consider the discrete complex sinusoid:


$$ x[n] = e^{j(\omega n + \phi)} $$
  • When $\omega$ is close to 0, the signal oscillates slowly $\rightarrow$ a low frequency
  • When $\omega$ is close to $\pi$ or $-\pi$, the signal oscillates rapidly $\rightarrow$ a high frequency

Note: The maximum frequency in discrete-time signals occurs when


$$ \omega = \pi \; \text{radians/sample} $$

This corresponds to the fastest possible oscillation in a discrete signal, where the samples alternate every step:


$$ x[n] = \cos(\pi n) = (-1)^n $$

Frequencies beyond $\pi$ radians/sample are aliases of frequencies within the interval $[-\pi, \pi]$ due to the $2\pi$-periodicity of discrete-time sinusoids.


Example:

Low frequencies: $\omega$ closed to $0$ and $2\pi$, (here $\omega = \frac{ 2 \pi \cdot 1}{20} = \frac{2\pi}{20}$)



High frequencies: $\omega$ closed to $\pi$ and $-\pi$, (here $\omega = \frac{2 \pi \cdot 9}{20} = \frac{18\pi}{20}$)



Key Question

Which signal has higher frequency?


$$\omega_0 = \pi ~~~ \text{or} ~~~ \omega_0 = \frac{3\pi}{2}$$

Check which one oscillates faster.


In [ ]:
m%plot -s 560,400

N = 8;
n = 0:N-1;

x1 = cos(pi*n);
x2 = cos(3/2*pi*n);

subplot(2,1,1), stem(n,x1,'filled'), axis([0,7,-1.5 1.5]), ylabel('x_1')
subplot(2,1,2), stem(n,x2,'filled'), axis([0,7,-1.5 1.5]), ylabel('x_2')


6.3. Frequency in Discrete Sinusoids


$$0 \; \rightarrow \; \frac{1}{8}\pi \; \rightarrow \; \frac{2}{8}\pi \; \rightarrow \; \frac{8}{8}\pi$$

As $\omega$ increases:

  • The signal completes more cycles in the same number of samples.

  • Oscillation rate increases.


In [ ]:
%plot -s 560,600

N = 32;
n = 0:N-1;
x1 = cos(0*pi*n);
x2 = cos(1/8*pi*n);
x3 = cos(2/8*pi*n);
x4 = cos(1*pi*n);

subplot(4,1,1), stem(n,x1,'filled'), axis([0,31,-1.5 1.5])
subplot(4,1,2), stem(n,x2,'filled'), axis([0,31,-1.5 1.5])
subplot(4,1,3), stem(n,x3,'filled'), axis([0,31,-1.5 1.5])
subplot(4,1,4), stem(n,x4,'filled'), axis([0,31,-1.5 1.5])


$$2\pi \; \rightarrow \; \frac{15}{8}\pi \; \rightarrow \; \frac{14}{8}\pi \; \rightarrow \; \frac{8}{8}\pi$$

As $\omega$ decreases from $2\pi$ to $\pi$, the sinusoids become higher in frequency because their aliased equivalents approach $-\pi$.


$$ 0 \; \rightarrow \; -\frac{1}{8}\pi \; \rightarrow \; -\frac{2}{8}\pi \; \rightarrow \; -\frac{8}{8}\pi$$
In [ ]:
%plot -s 560,600

N = 32;
n = 0:N-1;
x5 = cos(2*pi*n);
x6 = cos(15/8*pi*n);
x7 = cos(14/8*pi*n);
x8 = cos(1*pi*n);

subplot(4,1,1), stem(n,x5,'filled'), axis([0,31,-1.5 1.5])
subplot(4,1,2), stem(n,x6,'filled'), axis([0,31,-1.5 1.5])
subplot(4,1,3), stem(n,x7,'filled'), axis([0,31,-1.5 1.5])
subplot(4,1,4), stem(n,x8,'filled'), axis([0,31,-1.5 1.5])



6.4. Aliasing

In discrete-time signal processing, aliasing is the phenomenon where distinct continuous-time frequencies become indistinguishable after sampling. This is due to the periodic nature of complex exponentials in the discrete-time domain.


If you continue increasing frequency beyond $\pi$, the waveform begins to slow down, as it wraps back around due to periodicity.


In [ ]:
%plot -s 560,400

t = linspace(0,10*2*pi,100);
x = sin(t);
y = cos(t);

ts = linspace(0,10*2*pi,10);
xs = sin(ts);
ys = cos(ts);

tc = linspace(0,10*2*pi,100);
xc = sin(1/10*tc);
yc = cos(1/10*tc);

subplot(2,1,1), plot(t,x,'--'), hold on
plot(ts,xs,'o','markerfacecolor','r'),
plot(tc,xc,'r-'), hold off
title('sin(t)')
yticks([-1,0,1])
xlim([0,10*2*pi])
subplot(2,1,2), plot(t,y,'--'), hold on
plot(ts,ys,'o','markerfacecolor','red'),
plot(tc,yc,'r'), hold off
xlabel('sec'), title('cos(t)')
yticks([-1,0,1])
xlim([0,10*2*pi])

In [ ]:
%plot -s 560,400

t = linspace(0,10*2*pi,100);
x = sin(t);
y = cos(t);

ts = linspace(0,10*2*pi,5);
xs = sin(ts);
ys = cos(ts);

tc = linspace(0,10*2*pi,100);
xc = sin(1/5*tc);
yc = cos(1/5*tc);

subplot(2,1,1), plot(t,x,'--'), hold on
plot(ts,xs,'o','markerfacecolor','r'),
plot(tc,xc,'r-'), hold off
title('sin(t)')
yticks([-1,0,1])
xlim([0,10*2*pi])
subplot(2,1,2), plot(t,y,'--'), hold on
plot(ts,ys,'o','markerfacecolor','red'),
plot(tc,yc,'r'), hold off
xlabel('sec'), title('cos(t)')
yticks([-1,0,1])
xlim([0,10*2*pi])


The wagon wheel effect refers to the phenomenon where a wheel (e.g., on a wagon or car) appears to rotate slowly, stand still, or even spin backwards when filmed or viewed under discrete sampling.

In [ ]:
from IPython.display import YouTubeVideo
YouTubeVideo('jHS9JGkEOmA', width = "560", height = "315")
Out[ ]:




7. Signal Visualization


Harmonic Sinusoids

The harmonic sinusoids are complex exponentials of the form:


$$ x[n] = e^{j \frac{2\pi}{N}kn} $$

where:

  • $k \in \mathbb{Z}$ is the harmonic index
  • $N \in \mathbb{Z}^+$ is the period of the signal

These sinusoids are called harmonic because their frequencies are integer multiples of a fundamental frequency:


$$ \omega_k = \frac{2\pi k}{N} = \frac{2\pi }{N}k $$



Periodicity of Harmonic Sinusoids

Let


$$ x[n] = e^{j(\omega n + \phi)} \quad \text{with} \quad \omega = \frac{2\pi k}{N} $$

This is a harmonic sinusoid, where:

  • $k$ is an integer (harmonic index)
  • $N$ is the signal period (number of samples per cycle)

We can show that $x[n]$ is periodic with period $N$:


$$ x[n + N] = e^{j\omega(n + N) + j\phi} = e^{j\omega n + j\phi} \cdot e^{j\omega N} = x[n] \cdot e^{j\cdot 2\pi k} = x[n] $$

Since $e^{j\cdot 2\pi k} = 1$, the signal repeats every $N$ samples.



7.1. Visualizing the Harmonic Sinusoidals


$$x[n] = e^{j \omega n }, \qquad \omega = \frac{2 \pi}{N}k$$
In [ ]:
%plot -s 560,420

N = 8;
k = 1;
w = 2*pi/N*k;
z1 = exp(1j*w);

n = 0:N-1;
z = (z1.^n).';

zplane(z)
title(['$z~{\rm in~the~complex~plane}$'],'interpreter','LaTeX','fontsize',12);

In [ ]:
%plot -s 560,420

k = 3;

N = 8;
n = 0:N-1;

xp = exp(1j*2*pi/N*k*n);
x = exp(1j*2*pi/N*k*0);

plot(real(xp),imag(xp),'o'), hold on
plot(real(x),imag(x),'o', 'MarkerFaceColor','b', 'MarkerEdgeColor','b'), hold off
grid on
axis equal; axis([-1.5, 1.5,-1.4 1.4])

In [ ]:
%plot -s 560,420

x = exp(1j*2*pi/N*k*1);

plot(real(xp),imag(xp),'o'), hold on
plot(real(x),imag(x),'o', 'MarkerFaceColor','b', 'MarkerEdgeColor','b'), hold off
grid on
axis equal; axis([-1.5, 1.5,-1.4 1.4])

In [ ]:
%plot -s 560,420

x = exp(1j*2*pi/N*k*2);

plot(real(xp),imag(xp),'o'), hold on
plot(real(x),imag(x),'o', 'MarkerFaceColor','b', 'MarkerEdgeColor','b'), hold off
grid on
axis equal; axis([-1.5, 1.5,-1.4 1.4])

In [ ]:
%plot -s 560,420

x = exp(1j*2*pi/N*k*3);

plot(real(xp),imag(xp),'o'), hold on
plot(real(x),imag(x),'o', 'MarkerFaceColor','b', 'MarkerEdgeColor','b'), hold off
grid on
axis equal; axis([-1.5, 1.5,-1.4 1.4])

In [ ]:
%plot -s 560,420

x = exp(1j*2*pi/N*k*4);

plot(real(xp),imag(xp),'o'), hold on
plot(real(x),imag(x),'o', 'MarkerFaceColor','b', 'MarkerEdgeColor','b'), hold off
grid on
axis equal; axis([-1.5, 1.5,-1.4 1.4])

In [ ]:
%plot -s 560,420

x = exp(1j*2*pi/N*k*5);

plot(real(xp),imag(xp),'o'), hold on
plot(real(x),imag(x),'o', 'MarkerFaceColor','b', 'MarkerEdgeColor','b'), hold off
grid on
axis equal; axis([-1.5, 1.5,-1.4 1.4])

In [ ]:
%plot -s 560,420

x = exp(1j*2*pi/N*k*6);

plot(real(xp),imag(xp),'o'), hold on
plot(real(x),imag(x),'o', 'MarkerFaceColor','b', 'MarkerEdgeColor','b'), hold off
grid on
axis equal; axis([-1.5, 1.5,-1.4 1.4])

In [ ]:
%plot -s 560,420

x = exp(1j*2*pi/N*k*7);

plot(real(xp),imag(xp),'o'), hold on
plot(real(x),imag(x),'o', 'MarkerFaceColor','b', 'MarkerEdgeColor','b'), hold off
grid on
axis equal; axis([-1.5, 1.5,-1.4 1.4])


7.2. Visual Matrix of Harmonic Sinusoids


$$x[n] = e^{j \omega n }, \qquad \omega = \frac{2 \pi}{N}k$$
In [ ]:
%plot -s 800,600

N = 8;
n = 0:N-1;

for k = 0:N-1;
    x = exp(1j*(2*pi/N)*k*n);

    subplot(8,2,2*k+1)
    stem(n,real(x),'b','filled');
    xticks([])
    ylabel(['k = ',num2str(k)],'fontsize',10);
    axis([0, 7, -1, 1]);

    subplot(8,2,2*k+2)
    stem(n,imag(x),'r','filled');
    xticks([])
    axis([0, 7, -1, 1]);
end

subplot(821)
title(['${\rm Re}(e^{j \frac{2\pi}{8}kn}) = \cos(\frac{2\' ...
       'pi}{8}kn)$'],'interpreter','LaTeX','fontsize',12);

subplot(822)
title(['${\rm Im}(e^{j \frac{2\pi}{8}kn}) = \sin(\frac{2\' ...
       'pi}{8}kn)$'],'interpreter','LaTeX','fontsize',12);

subplot(8,2,15), xticks([0,1,2,3,4,5,6,7]), xlabel('n')
subplot(8,2,16), xticks([0,1,2,3,4,5,6,7]), xlabel('n')



Matrix Visualization of Harmonic Sinusoids

We define a time-frequency matrix of size $N \times N$:


$$ X[n, k] = e^{j \frac{2\pi}{N}kn} $$

where:

  • $n = 0, 1, \dots, N-1$ is the time index
  • $k = 0, 1, \dots, N-1$ is the frequency index (harmonic number)

In [ ]:
%plot -s 900,400

N = 8;
n = 0:N-1;
for k = 0:N-1
    D(:,k+1) = exp(1j*(2*pi/N)*k*n).';
end

subplot(121), imagesc(n,n,real(D)), colormap('jet'), axis square
xlabel('$k$','interpreter','LaTeX','fontsize',12);
ylabel('$n$','interpreter','LaTeX','fontsize',12);
title('${\rm Re}(e^{j\frac{2\pi}{N}kn})=\cos(\frac{2\pi}{N}kn)$',...
'interpreter','LaTeX','fontsize',12);
colorbar

subplot(122), imagesc(n,n,imag(D)), colormap('jet'), axis square
xlabel('$k$','interpreter','LaTeX','fontsize',12);
ylabel('$n$','interpreter','LaTeX','fontsize',12);
title('${\rm Im}(e^{j\frac{2\pi}{N}kn})=\sin(\frac{2\pi}{N}kn)$',...
'interpreter','LaTeX','fontsize',12);
colorbar




8. Complex Exponential Signals with Damping

A natural generalization of the complex exponential signal is to consider exponentials of the form $z^n$, where the base $z$ is a complex number. Let:


$$ z = |z| e^{j\omega}, \qquad z \in \mathbb{C} $$

This is the polar form of a complex number, where:

  • $|z|$ is the magnitude (distance from the origin in the complex plane)
  • $\omega = \angle z$ is the phase angle (measured counterclockwise from the positive real axis)

The complex number $z$ can be interpreted geometrically as a point or vector in the complex plane with polar coordinates $(|z|, \omega)$.



8.1. Exponentiation: Spirals and Damping

When a complex number $z$ is raised to an integer power $n$, the result is:


$$ z^n = \left( |z| e^{j\omega} \right)^n = |z|^n \cdot e^{j\omega n} $$

This separates naturally into two components:

  • Amplitude envelope: $|z|^n$ is a real-valued exponential term that governs the growth or decay of the signal magnitude
  • Phase term*: $e^{j\omega n}$ is a complex sinusoid that determines the angular (rotational) behavior of the signal in the complex plane

Spiral Behavior

The signal $z^n = |z|^n e^{j\omega n}$ traces a spiral trajectory in the complex plane:

  • If $|z| < 1$, the spiral decays inward toward the origin
  • If $|z| > 1$, the spiral grows outward away from the origin
  • If $|z| = 1$, the trajectory remains on the unit circle — a pure rotation without damping or growth

This structure is often referred to as a damped (or growing) complex sinusoid.


Note that the phase angle increases linearly with $n$, since:


$$ \text{angle}(z^n) = \omega n $$

Hence, the term $e^{j\omega n}$ traces a circle (or rotates) with constant angular velocity $\omega$.


In [ ]:
from IPython.display import YouTubeVideo
YouTubeVideo('vDulP6vTa9g', width = "560", height = "315")
Out[ ]:



$$x[n]=\gamma^n e^{j\frac{2\pi}{N} n}$$

In [ ]:
%% real and imag parts

r = 0.95;
N = 20;
n = 0:2*N-1;
x = (r.^n).*exp(1j*2*pi/N*n);


1) retangular form

In [ ]:
%plot -s 560,400

subplot(2,1,1)
stem(n,real(x),'filled'), hold on
plot(n, [1;-1]*r.^n,'k--'), hold off
ylabel('Re')

subplot(2,1,2)
stem(n,imag(x),'filled'), hold on
plot(n, [1;-1]*r.^n,'k--'), hold off
ylabel('Im'), xlabel('n')

In [ ]:
%plot -s 560,520

c = [0, 0.4470, 0.7410];

plot3(n,real(x),imag(x),'o','MarkerFaceColor',c,'MarkerEdgeColor',c), hold on
plot3(n,zeros(size(n)),zeros(size(n)),'k--'), hold off
xlabel('n'), ylabel('Re'), zlabel('Im')
grid on
ylim([-1,1])
zlim([-1,1])
view([20,30])


2) polar form

$$ \begin{align*} x[n] &=\gamma^n e^{j\frac{2\pi}{N} n}\\ &= \lvert x[n]\lvert \, e^{j\angle x[n]} \end{align*} $$
In [ ]:
%% polar coordinate

fig = polar(angle(x),abs(x),'o');      % theta in radian
set(fig,'MarkerFaceColor',[0, 0.4470, 0.7410],'MarkerEdgeColor',[0, 0.4470, 0.7410]);

In [ ]:
%% polar coordinate

subplot(3,1,1)
stem(n,abs(x),'filled')
ylabel('|x[n]|','fontsize',12)

subplot(3,1,2)
stem(n,phase(x),'filled')
ylabel('\angle x[n] in phase','fontsize',12)

subplot(3,1,3)
stem(n,angle(x),'filled')
ylabel('\angle x[n] in angle','fontsize',12), xlabel('n')




9. Signals are Vectors

Discrete-time signals of finite length can be naturally represented as vectors in a vector space.

  • If the signal values are real, the signal is a vector in $\mathbb{R}^N$
  • If the signal values are complex, the signal is a vector in $\mathbb{C}^N$

Let $x[n]$ be a signal defined for $n = 0, 1, \dots, N-1$. Then the vector representation of $x[n]$ is:


$$ x = \begin{bmatrix} x[0] \\ x[1] \\ \vdots \\ x[N-1] \end{bmatrix} \in \mathbb{R}^N \; \text{or} \; \mathbb{C}^N $$



9.1. Transpose and Conjugate Transpose

In linear algebra, we frequently use transposition and conjugate transposition when working with vectors and matrices.


Transpose (denoted by $T$)

The transpose of a column vector is a row vector:


$$ x^T = \begin{bmatrix} x[0] & x[1] & \cdots & x[N-1] \end{bmatrix} $$

This operation does not affect the numerical values—it only changes the shape (orientation) of the vector.


Conjugate Transpose (denoted by $H$)

Also known as the Hermitian transpose, this operation both transposes the vector and applies the complex conjugate to each element:


$$ x^H = \begin{bmatrix} x[0]^* & x[1]^* & \cdots & x[N-1]^* \end{bmatrix} $$

This is especially important when working in $\mathbb{C}^N$, as inner products and orthogonality are defined using conjugate transposition.


In [ ]:
% be careful with ' in MATLAB

a = [2 + 1j, 1 - 2j];
a'
a.'
ans =

   2.0000 - 1.0000i
   1.0000 + 2.0000i


ans =

   2.0000 + 1.0000i
   1.0000 - 2.0000i




9.2. Matrix Multiplication as Linear Combination

Matrix-vector multiplication can be interpreted as a linear combination of vectors.

Let:

  • $x_0, x_1, \dots, x_{M-1} \in \mathbb{R}^N$ (or $\mathbb{C}^N$) be column vectors
  • $\alpha_0, \alpha_1, \dots, \alpha_{M-1} \in \mathbb{R}$ (or $\mathbb{C}$) be scalars

Then the linear combination of the vectors is:


$$ y = \alpha_0 x_0 + \alpha_1 x_1 + \cdots + \alpha_{M-1} x_{M-1} = \sum_{m=0}^{M-1} \alpha_m x_m $$



Step-by-Step: Representing as Matrix Multiplication

Step 1: Form a matrix by stacking the vectors

Let $X$ be the $N \times M$ matrix whose columns are the vectors $x_m$:


$$ X = [x_0 \mid x_1 \mid \cdots \mid x_{M-1}] $$

Each column of $X$ is one of the vectors being combined.


Step 2: Stack the scalar weights into a column vector

Let $\alpha$ be the $M \times 1$ vector of coefficients:


$$ \alpha = \begin{bmatrix} \alpha_0 \\ \alpha_1 \\ \vdots \\ \alpha_{M-1} \end{bmatrix} $$

Step 3: Matrix-vector product expresses the linear combination


$$y=\alpha_0 x_0 + \alpha_1 x_1 + \cdots + \alpha_{M-1}x_{M-1} = \sum_{m=0}^{M-1}\alpha_m x_m = [x_0 \mid x_1 \mid \cdots \mid x_{M-1}] \begin{bmatrix}\alpha_0 \\ \alpha_1 \\ \vdots \\\alpha_{M-1} \end{bmatrix} = X \alpha$$

This result $y \in \mathbb{R}^N$ (or $\mathbb{C}^N$) is a linear combination of the columns of $X$, weighted by the entries of $\alpha$.




9.3. Inner Product

The inner product (also called the dot product) is a fundamental operation for comparing two vectors. For discrete-time signals interpreted as vectors in $\mathbb{C}^N$, the inner product is defined as:


$$ \langle x, y \rangle = y^H x = \sum_{n=0}^{N-1} x[n]\, y[n]^* $$

Here, $y^H$ denotes the conjugate transpose of $y$, and $x[n], y[n]^*$ multiplies the $n$-th entry of $x$ by the complex conjugate of the $n$-th entry of $y$.


The inner product takes two signals and returns a single complex number. It quantifies both alignment and magnitude similarity between the signals.


Inner Product with Itself

When a signal is compared with itself, the result is the sum of squared magnitudes:


$$ \langle x, x \rangle = \sum_{n=0}^{N-1} x[n]\, x[n]^* = \sum_{n=0}^{N-1} |x[n]|^2 = \|x\|_2^2 $$

This is the squared $\ell_2$ norm (Euclidean energy) of the signal.


Orthogonality

Two signals $x, y \in \mathbb{C}^N$ are said to be orthogonal if their inner product is zero:


$$ \langle x, y \rangle = 0 $$

Orthogonality means the signals are completely uncorrelated in the vector space sense. This concept is foundational in constructing orthonormal bases, such as those used in the discrete Fourier transform.


Example: Two sets of orthogonal signals




9.4. Harmonic Sinusoids are Orthogonal

Consider the set of discrete complex exponentials (harmonic sinusoids) defined by


$$ d_k[n] = e^{j\frac{2\pi k}{N}n}, \qquad 0 \leq n \leq N - 1, \quad 0 \leq k \leq N - 1 $$

where $k$, $n$, and $N$ are integers.


We claim that these harmonic sinusoids are mutually orthogonal over $n = 0, 1, \cdots, N-1$. That is,


$$ \langle d_k, d_l \rangle = 0 \quad \text{for} \quad k \ne l $$

This can be shown as follows:


$$ \begin{align*} \langle d_k, d_l \rangle &= \sum_{n=0}^{N-1} d_k[n] \, d_l[n]^* \\ &= \sum_{n=0}^{N-1} e^{j\frac{2\pi k}{N}n} \cdot \left(e^{j\frac{2\pi l}{N}n}\right)^* \\ &= \sum_{n=0}^{N-1} e^{j\frac{2\pi k}{N}n} \cdot e^{-j\frac{2\pi l}{N}n} \\ &= \sum_{n=0}^{N-1} e^{j\frac{2\pi}{N}(k - l)n} \end{align*} $$

Let $r = k - l \in \mathbb{Z}$. For $r \ne 0$, define $a = e^{j\frac{2\pi}{N}r}$, and observe that $a \ne 1$. Then:


$$ \sum_{n=0}^{N-1} a^n = \frac{1 - a^N}{1 - a} $$

Since $a^N = e^{j2\pi r} = 1$, the numerator becomes zero, and we have:


$$ \sum_{n=0}^{N-1} a^n = 0 \quad \Rightarrow \quad \langle d_k, d_l \rangle = 0 \quad \text{for } k \ne l $$

This confirms that the harmonic sinusoids ${d_k[n]}$ form an orthogonal set over $n = 0, \cdots, N-1$.


This property underpins many results in Fourier analysis and digital signal processing, especially in the context of the Discrete Fourier Transform (DFT).


In [ ]:
%plot -s 560,400

N = 32;
n = 0:N-1;

k = 1;
d1 = cos(2*pi/N*k*n)';

k = 2;
d2 = cos(2*pi/N*k*n)';

subplot(211)
stem(n,d1,'filled'), ylabel('d_1[n]'), axis tight
subplot(212)
stem(n,d2,'filled'), ylabel('d_2[n]'), axis tight

% Note: in Matlab, the operation ' performs complex conjugate transpose
innerproduct = d2'*d1
innerproduct =

  -2.2572e-15


In [ ]:
%plot -s 560,400

N = 32;
n = 0:N-1;

k = 1;
d1 = exp(1j*2*pi/N*k*n).';

k = 3;
d2 = exp(1j*2*pi/N*k*n).';

subplot(211)
stem(n,real(d1),'b','marker','none'); hold on, ylabel('d_1[n]')
stem(n,imag(d1),'r','marker','none'); hold off
title('Real part = Blue, Imaginary part = Red','fontsize',10)

subplot(212)
stem(n,real(d2),'b','marker','none'); hold on, ylabel('d_2[n]')
stem(n,imag(d2),'r','marker','none'); hold off

% Note: in Matlab, the operation ' performs complex conjugate transpose
innerproduct = d2'*d1
innerproduct =

  -1.8965e-15 + 8.7512e-16i



$$d_k[n] = \frac{1}{\sqrt{N}} e^{j{2\pi k \over N}n}$$
In [ ]:
% to check two complex signals are orthonormal

N = 16;
n = 0:N-1;

k = 3;
s_3 = 1/sqrt(N)*exp(1j*2*pi/N*k*n).';

k = 5;
s_5 = 1/sqrt(N)*exp(1j*2*pi/N*k*n).';

% ': complex conjugate transpose
s_3'*s_5    % to see they are orthogonal
s_3'*s_3    % to see it is normalized
s_5'*s_5    % to see it is normalized
ans =

  -4.1633e-16 + 8.1780e-17i


ans =

     1


ans =

     1




9.5. Matrix Multiplication as a Sequence of Inner Products of Rows

Let $X$ be an $N \times M$ matrix and $\alpha$ an $M \times 1$ column vector. The product


$$ y = X \alpha $$

produces an $N \times 1$ output vector $y$.


Each entry $y[n]$ in the result can be interpreted as the inner product of the $n$-th row of $X$ with the vector $\alpha$.


The matrix $X$ can be written as


$$ X = \begin{bmatrix} \vdots & \vdots & & \vdots \\ x_0[n] & x_1[n] & \cdots & x_{M-1}[n] \\ \vdots & \vdots & & \vdots \end{bmatrix} $$

where the $n$-th row consists of the values $x_m[n]$ for $m = 0, 1, \cdots, M-1$.


Then the output vector is


$$ y = \begin{bmatrix} \vdots \\ y[n] \\ \vdots \end{bmatrix} = X \alpha $$

Each component of $y$ is computed as


$$ y[n] = \sum_{m=0}^{M-1} \alpha_m x_m[n] = \langle \text{row } n \text{ of } X,\; \alpha \rangle $$

This shows that matrix-vector multiplication can also be interpreted row-wise as a sequence of inner products, in contrast to the earlier column-wise interpretation as a linear combination of vectors.


In [ ]:
%%javascript
$.getScript('https://kmahelona.github.io/ipython_notebook_goodies/ipython_notebook_toc.js')