The Rich Man’s Square Wave Generator


What you will learn

  • Software: python, matplotlib
  • Domain: a different way of looking at Fourier series

Do this in python, mainly for the visualization capabilities

Rich man’s square wave generator

  • Create a sine wave of a given frequency and amplitude. Plot it for one period
  • Create a second sine wave of twice the frequency and half the amplitude as the first. Add the two cycles to the one from the previous step.
  • Continue with a third, fourth, … nth sine wave of successively higher frequencies and smaller amplitudes.
  • What waveform do we get as we add higher frequency components?

Analysis

  • Plot the error between your square wave and a true square wave at each step. Can you bring this down to zero? what is the limit? Can you prove this limit?

Other combinations

  • Take odd multiples of frequency and divide the amplitudes by the multiple squared
  • Take odd multiples of frequency and divide the amplitudes by the multiple squared
, ,

One response to “The Rich Man’s Square Wave Generator”

Leave a Reply

Your email address will not be published.