Fourier Series

  • any periodic signal can be approximated by a sum of $N_\mathit{part}$ sinusoids
  • with individual
    • amplitude $a_i$
    • frequency $f_i$
    • phase $\varphi_i$
\begin{equation} \displaystyle y = \sum\limits_{i=1}^{N_{part}} a_i \ sin(2 \pi f_i \ t+ \varphi_i) \end{equation}

Basic Waveforms

Certain basic waveforms can be generated with spefific Fourier series.

Triangular

\begin{equation} X(t) = \frac{8}{\pi^2} \sum\limits_{i=0}^{N} (-1)^{(i)} \frac{\sin(2 \pi (2i +1) f\ t)}{(2i +1)^2} \end{equation}
In [14]:
from numpy import linspace, sin, zeros
from math import pi
import matplotlib.pyplot as plt
from matplotlib2tikz import save as tikz_save

from IPython.display import display, Markdown, clear_output
import IPython.display as ipd
import ipywidgets as widgets


slider = widgets.FloatSlider(
         value=1,
         min=0,
         max=10.0,
         step=0.1,)

nPartials   = 5 # number of partials
f0          = 200  # signal frequency
fs          = 48000

def triang(t,f0, partCNT):

    y = (8/pow(pi,2)) * pow(-1, partCNT) * \
    sin(2*pi* f0 * (2* partCNT +1) *t) *  \
    (1/pow(2*partCNT+1,2))  
    
    return y

t = linspace(0,1,fs)    
f = linspace(-0.5,0.5,fs)

x = zeros(fs)
for partCNT in range(nPartials):
    x+=triang(t,f0,partCNT)

fig1, ax1 = plt.subplots()
ax1.plot(t[0:1000],x[0:1000])
plt.title("Triangular")


ax1.set_xlabel('t/s');
ax1.set_ylabel('x' ,color = [ 0.3, 0.3, 0.3]);


slider

ipd.display(ipd.Audio(x, rate=fs))