Skip to content
Tutorials Center
My learning

Topics

Lesson 6 of 38 ยท Discrete Signals

Signal Operations, Energy and Symmetry

Learn the basic operations on discrete signals (shifting, scaling, time reversal, adding), plus energy, power, even and odd parts, and correlation, in Python.

Once you have signals, you transform them. Almost everything in DSP is made from a handful of operations: delay, scale, add, flip and multiply. This lesson names them, shows what they do to a sequence, and introduces the measures of size (energy and power) and the symmetric decomposition that appear in every later chapter.

Operations on the independent variable

These change the index n:

Operation Formula Effect
Delay (shift right) y[n] = x[n - k], k > 0 The signal happens k samples later
Advance (shift left) y[n] = x[n + k] The signal happens earlier (needs knowledge of the future)
Time reversal y[n] = x[-n] Flip about n = 0
Decimation by M y[n] = x[M*n] Keep every M-th sample, rate drops
Expansion by L insert L-1 zeros between samples Rate rises, spectrum images appear

The trap: a delay moves the plot to the right. x[n-2] is zero where n-2 is outside the range of x, so the signal starts later.

Python Shift, flip, decimate, expand

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Operations on the amplitude

These change the values: scale y = a*x, add y = x1 + x2, multiply y = x1 * x2 (as in modulation), differentiate y[n] = x[n] - x[n-1] (the first difference) and accumulate y[n] = sum of x[k] for k <= n (a running sum). Difference and accumulation undo each other, like derivative and integral.

Python Difference and running sum

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Energy and power

How "big" is a signal? Two definitions cover different situations.

  • Energy: E = sum over all n of |x[n]|^2. A finite, decaying signal (a pulse, an echo) has finite energy.
  • Average power: P = limit of (1/(2N+1)) * sum from -N to N of |x[n]|^2. A signal that goes on forever (a sine) has infinite energy but finite power.

For a periodic signal with period N, power is the average over one period. A sine of amplitude A has P = A^2/2. RMS is sqrt(P).

Python Energy of a pulse, power of a sine

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Even and odd signals

A signal is even if x[-n] = x[n] (mirror symmetric about n = 0) and odd if x[-n] = -x[n] (so x[0] = 0). Every signal splits uniquely into an even and an odd part:

x_even[n] = (x[n] + x[-n]) / 2, x_odd[n] = (x[n] - x[-n]) / 2, and x = x_even + x_odd.

Cosines are even, sines are odd. Symmetry halves the work in many algorithms, and the linear-phase FIR filters of chapter 4 depend on it.

Python Even and odd decomposition

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Correlation: how alike are two signals?

The correlation of x and y multiplies one by a shifted copy of the other and sums:

r_xy[k] = sum over n of x[n] * y[n - k]

It peaks at the shift where the signals line up best. This finds an echo's delay, aligns recordings and detects a known pattern in noise (the matched filter). It looks a lot like convolution: correlation is convolution with one signal flipped.

Python Find the delay of an echo

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The peak stands far above the typical value, even though the pattern is hard to see in the raw data.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What does y[n] = x[n - 3] do to a plot of x?

    A delay moves the signal later, so features appear at larger n.
  2. 2. A sine of amplitude 4 has average power:

    P = A^2 / 2 = 16 / 2 = 8.
  3. 3. Which signal has infinite energy but finite power?

    An endless sine keeps adding energy forever, but its average per sample stays constant.
  4. 4. The odd part of x[n] is:

    Subtracting the mirror image cancels everything symmetric and leaves the antisymmetric part.

Summary

  • Delay shifts right, advance shifts left, reversal mirrors about n = 0, decimation drops samples and expansion inserts zeros.
  • Scale, add, multiply, difference and running sum act on the amplitudes; difference and running sum are inverses.
  • Energy is sum |x|^2; average power is the mean of |x|^2; RMS is its square root.
  • Every signal is the sum of an even and an odd part.
  • Correlation measures similarity at each shift and finds hidden patterns.

Next: LTI Systems and Convolution