Example data table
| x | f(x) |
|---|---|
| -2.5 | -1 |
| -2 | -1 |
| -1.5 | -1 |
| -1 | -1 |
| -0.5 | -1 |
| 0 | 1 |
| 0.5 | 1 |
| 1 | 1 |
| 1.5 | 1 |
| 2 | 1 |
| 2.5 | 1 |
Formulas used
We assume a periodic function f(x) with period 2L on domain [-L, L]. The Fourier coefficients are computed as:
a0 = (1/L) ∫_{-L}^{L} f(x) dx
an = (1/L) ∫_{-L}^{L} f(x) cos(nπx/L) dx
bn = (1/L) ∫_{-L}^{L} f(x) sin(nπx/L) dx
The reconstruction uses f_series(x) = a0/2 + Σ_{n=1}^N [an cos(nπx/L) + bn sin(nπx/L)]. Numeric integration uses the trapezoidal rule.
How to use this calculator
- Select a preset waveform or choose "Custom samples" and paste x,y data for one period.
- Set half-period L (so period = 2L) and choose the number of harmonics N to include.
- Adjust numeric integration samples for accuracy (higher => slower).
- Press Compute Fourier Series. Results will appear above the form.
- Download CSV of reconstructed samples or generate a PDF of results if desired.