ENع
←Discrete-time signals
Lesson 15 · Discrete-time signals and systems

Discrete-time signals x[n]

15 min11 steps5 questionsIntermediate
About this lesson

A discrete-time signal is a list of numbers x[n], one for each whole number n. Follow one short list, 1, 3, 2, −1, through a row of memory cells and a stem plot. You will build the unit impulse δ[n] and the unit step u[n], delay a signal with x[n − 2], rebuild any list from scaled, shifted impulses, and meet the exponential aⁿ·u[n] and the sinusoid cos(ω₀n), whose frequency is in radians per sample. Then you add up its energy and write it all in Python with numpy. It builds on the sampling module (x[n] = x(nT)) and the first module's lessons on signal types and operations.

You'll learn to

Tick what you feel confident about. These self-checks do not affect your lesson score.

Fig 15 · Interactive
01 / 11

A signal as a list of numbers

A discrete-time signal x[n] is a list of numbers, one for each whole number n. Ours is x[−1] = 1, x[0] = 3, x[1] = 2, x[2] = −1, and 0 everywhere else. Note that n can be negative.

x[n] = a sequence: one number per whole n

n      ... −3  −2  −1   0   1   2   3   4 ...
x[n]   ...  0   0   1   3   2  −1   0   0 ...

n = 0 is just a chosen origin;
n = −1, −2 ... are as real as n = 1, 2

plot: one stem per n (a stem plot),
never a joined-up curve
Loading figure…
or ← →
Read the lesson step by step
  1. A signal as a list of numbers

    A discrete-time signal x[n] is a list of numbers, one for each whole number n. Ours is x[−1] = 1, x[0] = 3, x[1] = 2, x[2] = −1, and 0 everywhere else. Note that n can be negative.

    x[n] = a sequence: one number per whole n
    
    n      ... −3  −2  −1   0   1   2   3   4 ...
    x[n]   ...  0   0   1   3   2  −1   0   0 ...
    
    n = 0 is just a chosen origin;
    n = −1, −2 ... are as real as n = 1, 2
    
    plot: one stem per n (a stem plot),
    never a joined-up curve
  2. n counts samples, not seconds

    The index n is a position in the list, not a time in seconds. If the list came from sampling every T seconds, then x[n] = x(nT). Between whole numbers there is nothing: x[0.5] does not exist.

    n = ..., −2, −1, 0, 1, 2, ...  (integers only)
    
    from sampling (see "Sampling: taking snapshots"):
      x[n] = xa(n·T),  T = sampling period
    
    the list itself does not know T:
    the same numbers could be 1 ms or 1 day apart
    
    x[0.5]  -> not defined
  3. The unit impulse δ[n]

    The unit impulse δ[n] (say "delta of n") is the simplest signal: 1 at n = 0 and 0 everywhere else. It is a single sample. Watch it land in cell n = 0.

    δ[n] = 1  if n = 0
           0  otherwise
    
    n      −3  −2  −1   0   1   2   3   4
    δ[n]    0   0   0   1   0   0   0   0
    
    also called the unit sample
    (a Kronecker delta: no infinite spike,
     just the number 1 in one place)
  4. The unit step u[n]

    The unit step u[n] is 0 for negative n and 1 from n = 0 on, forever. It is a pile of impulses: u[n] = δ[n] + δ[n−1] + δ[n−2] + ... And back again: δ[n] = u[n] − u[n−1].

    u[n] = 1  if n ≥ 0
           0  if n < 0
    
    u[n] = Σ δ[n − k],  k = 0, 1, 2, ...
           (one impulse per cell from n = 0 on)
    
    δ[n] = u[n] − u[n − 1]
      n = 0:  1 − 0 = 1
      n = 3:  1 − 1 = 0
    
    the memory shows n up to 4; u[n] goes on
  5. Shifting: x[n − 2] is a delay

    Replace n by n − 2 and every value moves two places to the right: y[n] = x[n − 2]. Each sample now arrives two steps later, which is a delay. x[n + 2] would move left: an advance.

    y[n] = x[n − 2]
    
     y[1] = x[−1] = 1
     y[2] = x[0]  = 3
     y[3] = x[1]  = 2
     y[4] = x[2]  = −1
    
    x[n − n0], n0 > 0:  moves right (delay)
    x[n + n0], n0 > 0:  moves left  (advance)
    flip: x[−n] mirrors the list about n = 0
  6. Every signal is a sum of impulses

    Any list is a sum of scaled, shifted impulses: x[n] = 1·δ[n+1] + 3·δ[n] + 2·δ[n−1] − 1·δ[n−2]. Each impulse puts one value in one place. Later lessons take systems apart this way.

    x[n] = Σ x[k]·δ[n − k]   (sum over every k)
    
    k = −1:   1·δ[n + 1]   -> 1 at n = −1
    k =  0:   3·δ[n]       -> 3 at n = 0
    k =  1:   2·δ[n − 1]   -> 2 at n = 1
    k =  2:  −1·δ[n − 2]   -> −1 at n = 2
    
    δ[n − k] is 1 only at n = k,
    so each term fills exactly one cell
  7. Exponentials: aⁿ·u[n]

    x[n] = aⁿ·u[n] multiplies by the same number a at every step. With a = 0.8 the list is 1, 0.8, 0.64, 0.512 ... It shrinks because |a| < 1. With |a| > 1 it grows; with a < 0 its sign flips each sample.

    x[n] = aⁿ·u[n],  a = 0.8
    
     n = 0:  0.8⁰ = 1
     n = 1:  0.8¹ = 0.8
     n = 2:  0.8² = 0.64
     n = 3:  0.8³ = 0.512
    
    x[n + 1] = a·x[n]  (one multiply per step)
    |a| < 1 decays, |a| > 1 grows,
    a < 0 alternates: + − + − ...
    cells show 2 decimals (0.512 -> 0.51)
  8. Sinusoids: radians per sample

    x[n] = cos(ω₀n) with ω₀ = π/4 turns by π/4 radians every sample, so it repeats every 2π ÷ (π/4) = 8 samples. In discrete time, frequency ω₀ is measured in radians per sample.

    x[n] = cos(ω0·n),  ω0 = π/4 rad/sample
    
     n = 0: cos(0)    = 1.00
     n = 1: cos(π/4)  = 0.71
     n = 2: cos(π/2)  = 0.00
     n = 3: cos(3π/4) = −0.71
     n = 4: cos(π)    = −1.00
    
    periodic with period N only if ω0·N = 2πk
      (k a whole number): here N = 8
    cos(n) (ω0 = 1) never repeats exactly
  9. Two frequencies, the same samples

    Now take ω₀ = 7π/4, a much faster cosine (the thin curve). At every whole n it hits the same values: cos(7πn/4) = cos(2πn − πn/4) = cos(πn/4). The samples cannot tell these two apart.

    cos(7π/4 · n) = cos(2π·n − π/4 · n)
                  = cos(−π/4 · n)    (2π·n: whole turns)
                  = cos(π/4 · n)     (cos is even)
    
    in discrete time:
      ω0 and ω0 + 2π give identical sequences
      for cosines, ω0 and 2π − ω0 match too
      ω0 = π is the fastest: (−1)ⁿ
    this is aliasing, seen from the list's side
  10. Energy: add up the squares

    The energy of a signal is the sum of its squared values: E = Σ x[n]². Walk the list and square each value. The zeros add nothing, so E = 1 + 9 + 4 + 1 = 15.

    E = Σ |x[n]|²   (sum over every n)
    
     x[−1]² = 1
     x[0]²  = 9
     x[1]²  = 4
     x[2]²  = 1
             ---
     E      = 15
    
    finite list -> finite energy
    0.8ⁿ·u[n]: E = 1 / (1 − 0.64) = 2.78
    u[n]: E is infinite (1 + 1 + 1 + ...)
  11. In Python: an array and its n

    In Python with numpy, keep the values in one array and their indexes n in another. Python counts from 0, so Python's x[0] holds x[−1] of the maths. np.sum(x**2) gives the energy, 15.

    import numpy as np
    n = np.arange(-1, 3)
    x = np.array([1, 3, 2, -1])
    E = np.sum(x**2)   # 15
    
    >>> print(n)
    [-1  0  1  2]
    >>> print(x[0])     # first item = maths x[−1]
    1
    >>> print(x[-1])    # Python −1 = LAST item
    -1
    >>> print(E)
    15
    
    (Python 3 with numpy; arange stops before 3)

Quiz Unlocks after the last step.