Skip to content

Instantly share code, notes, and snippets.

@OddExtension5
Last active January 19, 2020 18:34
Show Gist options
  • Save OddExtension5/f4aafe66ddbe1edf1890c0bb13fd2bcc to your computer and use it in GitHub Desktop.
Save OddExtension5/f4aafe66ddbe1edf1890c0bb13fd2bcc to your computer and use it in GitHub Desktop.
Digital Signal Processing

Think DSP

  1. Discrete Fourier Transofrm
  2. Convolution Theorem
  3. Linear Time-Invariant Theory

Signal: It represents a continuous mathematical function

Wave: Contains an array of discrete samples

Spectrum: Contains the DFT of a Wave

Signal ------> Wave <-----> Spectrum

Spectral Analysis

  • Any signal can be represented as a sum of single frequency components
  • The Spectrum of a signal encodes the amplitude of each component

Discrete Fourier Transform (DFT)

  • DFT of a wave is its soectrum
  • FFT is an efficient algorithm
def make_spectrum(ys, framerate):
  hs = np.fft.rfft(ys)
  n = len(ys)   # no. of samples
  d = 1/framerate # time between samples
  fs = np.fft.rfftfreq(n,d)
  
  return Spectrum(hs,fs, framerate)

Filtering

  • A filter modifies a signal by amplifying.attenuating some components more than others
  • Low-pass filter: Attenuates high frequencies, lets low frequencies pass

Aliasing

  • We lose information on when we sample
  • If the sample rate is 10000 Hz the highest we can sample is 5000 Hz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment