What a Fourier series does
A Fourier series represents a periodic signal as a sum of sinusoids. In engineering, this is useful because
many systems respond differently to different frequencies.
\[
f(t)
=
\frac{a_0}{2}
+
\sum_{n=1}^{\infty}
\left[
a_n\cos(n\omega_0t)
+
b_n\sin(n\omega_0t)
\right].
\]
The calculator uses a finite number of harmonics, so it computes an approximation.
Period and fundamental frequency
If a signal repeats every period \(T\), its fundamental frequency is
\[
f_0=\frac{1}{T}.
\]
The fundamental angular frequency is
\[
\omega_0=\frac{2\pi}{T}.
\]
DC component
The DC component is the average value of the waveform over one period.
\[
\frac{a_0}{2}
=
\frac{1}{T}
\int_0^T f(t)\,dt.
\]
Signals with a nonzero average have a nonzero DC component.
Cosine coefficients
Cosine coefficients measure how much of each cosine harmonic appears in the signal.
\[
a_n
=
\frac{2}{T}
\int_0^T
f(t)\cos(n\omega_0t)\,dt.
\]
Sine coefficients
Sine coefficients measure how much of each sine harmonic appears in the signal.
\[
b_n
=
\frac{2}{T}
\int_0^T
f(t)\sin(n\omega_0t)\,dt.
\]
Finite reconstruction
A practical Fourier approximation uses only a finite number of harmonics.
\[
\hat f_N(t)
=
\frac{a_0}{2}
+
\sum_{n=1}^{N}
\left[
a_n\cos(n\omega_0t)
+
b_n\sin(n\omega_0t)
\right].
\]
Increasing \(N\) usually improves the reconstruction, especially for signals with sharp edges.
Harmonic magnitude and phase
The cosine and sine coefficients can be combined into a magnitude and phase form.
\[
C_n=\sqrt{a_n^2+b_n^2}.
\]
\[
\phi_n=\operatorname{atan2}(-b_n,a_n).
\]
\(C_n\) tells how strong the \(n\)-th harmonic is.
Square wave Fourier series
A symmetric square wave contains only odd sine harmonics.
\[
f(t)
=
\frac{4A}{\pi}
\left[
\sin(\omega_0t)
+
\frac{1}{3}\sin(3\omega_0t)
+
\frac{1}{5}\sin(5\omega_0t)
+\cdots
\right].
\]
The coefficients decrease as \(1/n\), so high harmonics remain important near the jumps.
Triangle wave Fourier series
A symmetric triangle wave also contains only odd harmonics, but the amplitudes decrease faster.
\[
b_n
=
\frac{8A}{\pi^2n^2}
(-1)^{(n-1)/2},
\qquad
n=1,3,5,\ldots
\]
Because the coefficients decrease as \(1/n^2\), triangle waves reconstruct smoothly with fewer harmonics.
Sawtooth wave Fourier series
A sawtooth wave contains many harmonics.
\[
b_n
=
\frac{2A}{\pi}
\frac{(-1)^{n+1}}{n}.
\]
Since the coefficients decrease as \(1/n\), sharp discontinuities require more harmonics.
Rectified sine signals
Rectification changes the harmonic content of a sine wave. A half-wave rectified sine has a DC component,
a fundamental sine term, and even cosine terms.
\[
f(t)=
\begin{cases}
A\sin(\omega_0t), & 0<\omega_0t<\pi,\\
0, & \pi<\omega_0t<2\pi.
\end{cases}
\]
A full-wave rectified sine contains a larger DC component and even harmonics.
Gibbs phenomenon
When a waveform has a jump discontinuity, the Fourier reconstruction overshoots near the jump.
This effect does not disappear completely, although it becomes narrower as more harmonics are added.
\[
\text{sharp jumps}
\quad\Longrightarrow\quad
\text{overshoot near discontinuities}.
\]
Square waves and sawtooth waves show this behavior clearly.
Engineering use of harmonic spectra
The harmonic spectrum tells which frequencies are present in the signal. In electrical engineering,
this helps analyze power quality, filters, switching waveforms, and distortion.
\[
f_n=nf_0,
\qquad
\omega_n=n\omega_0.
\]
A large \(C_n\) means that the \(n\)-th harmonic is strong.
Approximate RMS from Fourier coefficients
Fourier coefficients can estimate the RMS value of a reconstructed waveform.
\[
f_{\mathrm{rms}}
\approx
\sqrt{
\left(\frac{a_0}{2}\right)^2
+
\frac{1}{2}
\sum_{n=1}^{N}
\left(a_n^2+b_n^2\right)
}.
\]
This is useful for signal power and AC waveform analysis.
Custom periodic functions
For a custom signal, the calculator evaluates the Fourier integrals numerically over one period.
The entered function is treated as one period of a repeating signal.
\[
f(t+T)=f(t).
\]
This is useful when a waveform is known over one cycle but does not have a simple textbook coefficient formula.
Common mistakes
- Forgetting that the Fourier series assumes the signal is periodic.
- Using the wrong period \(T\), which changes every harmonic frequency.
- Expecting a finite Fourier sum to exactly match a discontinuous signal.
- Ignoring the DC component when the signal has a nonzero average.
- Confusing harmonic number \(n\) with frequency \(nf_0\).
- Using too few harmonics for sharp waveforms such as square waves or sawtooth waves.
- Entering a custom function that is not representative of one full period.