has two basic characteristics, its amplitude B and frequency f.
import stuff
import numpy as npimport matplotlib.pyplot as pltimport seaborn as snsimport matplotlib as mplsns.set(style="ticks", font_scale=1.5)# %matplotlib widget# Configure Matplotlib to use LaTeX fontplt.rcParams.update({"xtick.labelsize": 14,"text.usetex": True,"font.family": "serif","font.serif": ["Computer Modern Roman"]})
data to plot
T =2.0# sf =1.0/ Tn_periods =2.5dt =0.01B =0.6t = np.arange(0, T*n_periods + dt, dt)s = B * np.sin(2.0* np.pi * f * t)c = B * np.cos(2.0* np.pi * f * t)
In the figure above, the amplitude B=0.6 and we see that the distance between two peaks is called period, T=2 s. The frequency is defined as the inverse of the period:
f = \frac{1}{T}.
\tag{40.2}
When time is in seconds, then the frequency is measured in Hertz (Hz). For the graph above, therefore, we see a wave whose frequency is f = 1/(2 \text{ s}) = 0.5 Hz.
In the figure below, we see what happens when we vary the values of the frequency and amplitude.
The graph above introduces two new characteristics of a wave, its phase \phi, and its offset B. A more general description of a sine wave is
f(t) = B\sin(2\pi f t + \phi) + B_0.
\tag{40.3}
The offset B_0 moves the wave up and down, while changing the value of \phi makes the sine wave move left and right. When the phase \phi=2\pi, the sine wave will have shifted a full period, and the resulting wave is identical to the original:
B\sin(2\pi f t) = B\sin(2\pi f t + 2\pi).
\tag{40.4}
All the above can also be said about a cosine, whose general form can be given as
A\cos(2\pi f t + \phi) + A_0
\tag{40.5}
One final point before we jump into the deep waters is that the sine and cosine functions are related through a simple phase shift:
\cos\left(2\pi f t + \frac{\pi}{2}\right) = \sin\left(2\pi f t\right)
Any periodic signal is composed of a superposition of pure sine waves, with suitably chosen amplitudes and phases, whose frequencies are harmonics of the fundamental frequency of the signal.
40.3 Fourier series
a periodic function can be described as a sum of sines and cosines.
The most common way of representing the Fourier series is
f(t) = \frac{1}{2}a_0 + \sum_{n=1}^{\infty}a_n\cos(nt) + \sum_{n=1}^{\infty}b_n\sin(nt)
\tag{40.6}
for a periodic function f(t) in the interval -\pi<t<\pi, where
The series expressed as a sum of sines and cosines could be translated into an expression of a complex exponential by taking advantage of Euler’s formula:
e^{ix} = \cos(x) + i\sin(x)
40.4 Fourier transform
This is a generalization of a Fourier series, but for non-periodic signals. If we take the limit P\rightarrow\infty in the equations above, we have that
f(t) = \int_{-\infty}^{\infty} F(k) e^{2\pi i k t}dk,
where F(k) now takes the role of the coefficients from before, and it is given by
F(k) = \int_{-\infty}^{\infty} f(t) e^{-2\pi i k t}dk.
If t is in seconds, the frequency k is given in Hertz (Hz).
See the following animations to visualize the theorem in action.