Enter Signal and Series Settings
Example Data Table
This sample illustrates how truncation level changes the approximation of a square wave over one period.
| Preset | Amplitude | Period | Terms | Phase Shift | Approx. RMSE | Observation |
|---|---|---|---|---|---|---|
| Square | 1.0 | 6.283185 | 3 | 0° | 0.2284 | Strong smoothing near discontinuities. |
| Square | 1.0 | 6.283185 | 7 | 0° | 0.1542 | Edges improve, ringing becomes visible. |
| Square | 1.0 | 6.283185 | 15 | 0° | 0.1068 | Sharper transitions and smaller average error. |
| Triangle | 1.0 | 6.283185 | 15 | 0° | 0.0116 | Fast convergence because coefficients decay quickly. |
Formula Used
The calculator uses the truncated real Fourier series:
where:
ω0 = 2π / T
τ = (phase shift in degrees / 360) × T
Preset coefficient patterns
- Square: bn = 4A / (nπ) for odd n, otherwise 0.
- Sawtooth: bn = 2A(-1)n+1 / (nπ).
- Triangle: odd harmonics only, decaying as 1 / n².
- Rectified sine: even cosine harmonics dominate, plus a nonzero a0.
For preset waves, the calculator compares the reconstructed signal with the target waveform and reports RMSE, MAE, and maximum absolute error.
How to Use This Calculator
- Select a preset waveform or choose the custom coefficient mode.
- Enter amplitude, period, vertical shift, phase shift, harmonic count, sampling density, and displayed cycles.
- When using custom mode, add a0, then type the cosine and sine coefficient lists.
- Press Visualize Fourier Series to generate the result section above the form.
- Inspect the graph, coefficient table, error metrics, and dominant harmonic behavior.
- Use the CSV button to export numeric data or the PDF button to download a visual report.
Frequently Asked Questions
1. What does truncation mean in this visualizer?
Truncation keeps only the first N harmonics. Larger N usually improves detail and edge sharpness, but it also increases computation and can highlight ringing near jumps.
2. Why do ripples appear near sharp corners?
Those ripples are a Gibbs-type effect. Finite harmonic sums struggle near discontinuities, so overshoot remains visible even when many terms are added.
3. What does the a₀ coefficient represent?
a₀ controls the average level of the waveform before halving in the series. It sets the baseline or mean value of the periodic signal.
4. Why are some coefficients exactly zero?
Symmetry removes certain harmonics. Odd, even, half-wave, or rectified patterns can cancel either cosine terms, sine terms, or selected harmonic orders.
5. How does phase shift affect the graph?
Phase shift moves the waveform horizontally. Positive values delay the reconstructed pattern, while negative values advance it across the x-axis.
6. What does RMSE tell me here?
RMSE summarizes the typical approximation error between the target waveform and the truncated series. Lower RMSE generally indicates a closer overall match.
7. Can I build my own waveform with custom inputs?
Yes. Select Custom Coefficients, enter a₀, and provide comma-separated cosine and sine coefficient lists. The tool then synthesizes your waveform directly.
8. Why does the triangle wave converge faster?
Its harmonic magnitudes decay like 1/n², much faster than square or sawtooth waves. Faster decay means smoother reconstructions with fewer terms.