TExcelTAD
Home › Fourier Analysis & Signals › Fourier & Signals Intro

Fourier & Signals Intro

A guitar note, a heartbeat on an ECG, a Wi-Fi packet and a JPEG photo are all signals: values that change over time or space. Fourier analysis says that each of them is a sum of pure oscillations, and that many hard questions (Which notes are playing? How do I remove this hum? How fast must I sample? How do I blur an image quickly?) become easy once you look at those oscillations, the signal's spectrum. This course teaches that idea from Fourier series to the FFT, and computes every step in NumPy.

The reference books

The topic order follows two classic texts, used only as maps of topics:

  • Brad Osgood, Lectures on the Fourier Transform and its Applications (Stanford EE261). Osgood's lecture notes are free from Stanford Engineering Everywhere, and a book version is published by the AMS. They are the guide for Fourier series, the Fourier transform and its properties, the delta function, convolution, sampling and the DFT.
  • Alan V. Oppenheim and Alan S. Willsky, with S. Hamid Nawab, Signals and Systems (2nd edition, Prentice Hall). It is the guide for the systems side: LTI systems, impulse and frequency responses, filters, the z-transform and the link to the Laplace transform.

Thanks to the authors for these texts. All explanations, numbers, code and exercises in these lessons are written from scratch for this site.

What is in the course

Part Topics
1. Signals and complex exponentials signals as arrays, time shifts and scaling, complex numbers, eiωte^{i\omega t}, periodic signals
2. Fourier series coefficients, sine-cosine form, square and sawtooth waves, Gibbs, Parseval
3. The Fourier transform from series to transform, shift and scaling rules, duality, Plancherel, uncertainty
4. Delta, convolution, LTI systems the delta function, convolution, the convolution theorem, impulse and frequency responses
5. Sampling the sampling theorem, aliasing, sinc reconstruction, quantization
6. The DFT and FFT the DFT as a matrix, its properties, the FFT algorithm, np.fft, zero padding, fast convolution
7. Spectral analysis leakage, windows, power spectra, spectrograms
8. Filters moving averages, FIR design, IIR filters
9. The z-transform poles and zeros, difference equations, the Laplace link
10. Two dimensions 2-D transforms, image filtering, the DCT and JPEG
11. Applications pitch detection, compression, CNNs, fast multiplication

Here is the whole course in one example. A signal hides two tones under noise; the FFT finds them at once.

python · try it yourself
import numpy as np

fs = 1000                                   # samples per second
t = np.arange(0, 1, 1 / fs)                 # one second of time
rng = np.random.default_rng(0)
x = np.sin(2 * np.pi * 50 * t) + 0.5 * np.sin(2 * np.pi * 120 * t) + 0.8 * rng.normal(size=t.size)

X = np.fft.rfft(x)                          # spectrum of a real signal
freqs = np.fft.rfftfreq(x.size, 1 / fs)     # the frequency of each bin, in Hz
amp = 2 * np.abs(X) / x.size                # amplitude of each sinusoid
top = np.argsort(amp)[-2:][::-1]
print("strongest frequencies (Hz):", freqs[top].tolist())
print("their amplitudes:", np.round(amp[top], 2).tolist())
strongest frequencies (Hz): [50.0, 120.0]
their amplitudes: [1.01, 0.52]

In the time domain the noise is larger than the second tone; in the frequency domain both tones stand out clearly, with amplitudes close to the true 1.0 and 0.5.

What you should know first

The course is advanced. It assumes Calculus (integrals, Taylor series, complex numbers), Linear Algebra (inner products, orthogonal bases; see Projections and Fourier) and NumPy. A gentler first look at sine waves is in Waves and Signals. Differential equations appear only briefly; they get their own course in Differential Equations.

How lessons work

Each lesson states the idea in math notation, explains why it is true, computes it in NumPy, and ends with an In software note (where SciPy, audio tools and image codecs use it), exercises with answers and worked solutions, and a short quiz. All examples print text; plots are left to you as an extension.

Tip: NumPy's FFT returns complex arrays. Print them with np.round(X, 3).tolist() or look at np.abs (magnitude) and np.angle (phase) separately.

Exercises

Exercise 1: Frequency, period, angular frequency

A tone has frequency f=440f = 440 Hz (the A above middle C). What are its period and its angular frequency ω=2πf\omega = 2\pi f?

Answer

Period about 2.27 ms; ω≈2764.6\omega \approx 2764.6 rad/s.

Solution

T=1/f=1/440≈0.002273T = 1/f = 1/440 \approx 0.002273 s, and ω=2π⋅440≈2764.6\omega = 2\pi \cdot 440 \approx 2764.6 rad/s. Frequency counts cycles per second; angular frequency counts radians per second.

Exercise 2: Hide and find (code)

Change the example so the second tone is at 300 Hz with amplitude 0.3. Does the FFT still find it?

Answer

Yes: the two strongest bins are 50 Hz and 300 Hz.

Solution
python · try it yourself
import numpy as np
fs = 1000
t = np.arange(0, 1, 1 / fs)
rng = np.random.default_rng(0)
x = np.sin(2 * np.pi * 50 * t) + 0.3 * np.sin(2 * np.pi * 300 * t) + 0.8 * rng.normal(size=t.size)
amp = 2 * np.abs(np.fft.rfft(x)) / x.size
freqs = np.fft.rfftfreq(x.size, 1 / fs)
top = np.argsort(amp)[-2:][::-1]
print(freqs[top].tolist(), np.round(amp[top], 2).tolist())
[50.0, 300.0] [1.01, 0.27]

The noise spreads its energy over all 501 frequency bins, while each tone concentrates in one bin, which is why even a weak tone stands out.

Exercise 3: Why does the noise not hide the tone?

The noise has standard deviation 0.8 and the tone amplitude 0.3. Explain in one sentence why the FFT still separates them.

Answer

The tone's energy goes into one frequency bin, while the noise's energy is spread across all bins.

Solution

Over N=1000N = 1000 samples the tone adds coherently in its bin (its contribution grows like NN), while white noise adds incoherently (like N\sqrt{N} in every bin), so the tone-to-noise ratio in its bin improves as the recording gets longer.

Test yourself

What does the spectrum of a signal describe?

  1. its maximum value
  2. how much of each frequency it contains
  3. its duration
  4. its sampling rate only

Which NumPy function computes the spectrum of a real signal efficiently?

  1. np.convolve
  2. np.fft.rfft
  3. np.sort
  4. np.histogram

The angular frequency of a 50 Hz sine wave is…

  1. 50 rad/s
  2. 100π100\pi rad/s
  3. 50/π50/\pi rad/s
  4. 2π/502\pi/50 rad/s