Fourier Series Calculator: Square, Triangle, Sawtooth, Pulse and Rectified Waveforms
Get the Fourier series of a standard waveform, the harmonics, and a graph of how well the sum matches.
Engineering student calculators
Free textbook calculators with every step shown, so you can check your own working. Pick one, type in your numbers and see the formulas worked out. Or switch to Ask a question for an explained answer. No account needed.
Calculated from standard textbook formulas, with every step shown. The formulas are fixed, so the working does not need checking: what matters is the numbers you type in. Use these calculators only if you are competent to choose the inputs (loads, material strength, dimensions, supports) and check your units and assumptions. For learning and checking your own working: design and sign-off are for a qualified engineer. Drafting Central does not store the numbers you type.
How this calculator works
Choose the waveform: a square, triangular or sawtooth wave, a pulse train, or a full-wave or half-wave rectified sine. Enter the amplitude and the period, and the pulse width for a pulse train.
The calculator gives the average value, the amplitude of each harmonic, the fundamental, the rms value of the waveform and the share of its power in the harmonics you keep. It also gives the total harmonic distortion.
Choose how many harmonics to keep, and a time to evaluate the sum. The graph shows the sum over one period, so you can see the Gibbs overshoot at the sharp edges.
Formulas used
- x(t) = a_0 + \sum_{n=1}^{\infty}\left(a_n\cos\frac{2\pi nt}{T_0} + b_n\sin\frac{2\pi nt}{T_0}\right)
- x(t) = \sum_{n\,\mathrm{odd}}\frac{4A}{n\pi}\sin\frac{2\pi nt}{T_0}\ \ (\text{square})
- x(t) = \sum_{n\,\mathrm{odd}}\frac{8A}{n^2\pi^2}\cos\frac{2\pi nt}{T_0}\ \ (\text{triangle})
Worked example
With the default numbers in the calculator above:
- Waveform and its fundamental frequency: Square wave (even), period 20.00 ms, fundamental 50.00 Hz
- Average (dc) value: 0.00 V
- Amplitude of each harmonic (the harmonic number and its peak value, up to the 12th): 1: 1.2732; 3: 0.4244; 5: 0.2546; 7: 0.1819; 9: 0.1415
- Fundamental amplitude: 1.27 V (127.32 percent of the amplitude A)
- rms value of the waveform: 1.00 V
- Share of the power in the dc term and the first 9 harmonics: 95.96 %
- Total harmonic distortion of the kept harmonics (the harmonics above the fundamental, compared with the fundamental): 42.88 %
- Value of the sum at the time you gave: 1.08 V at t = 2.00 ms
Change the numbers in the calculator to see the full working, every step, for your own case.
A second worked example
A different case, with these numbers: Waveform Triangular wave, even (peak at t = 0).
- Waveform and its fundamental frequency: Triangular wave (even), period 20.00 ms, fundamental 50.00 Hz
- Average (dc) value: 0.00 V
- Amplitude of each harmonic (the harmonic number and its peak value, up to the 12th): 1: 0.8106; 3: 0.0901; 5: 0.0324; 7: 0.0165; 9: 0.0100
- Fundamental amplitude: 0.81 V (81.06 percent of the amplitude A)
- rms value of the waveform: 0.58 V
- Share of the power in the dc term and the first 9 harmonics: 99.98 %
- Total harmonic distortion of the kept harmonics (the harmonics above the fundamental, compared with the fundamental): 12.05 %
- Value of the sum at the time you gave: 0.60 V at t = 2.00 ms
Common questions
Why does a square wave only have odd harmonics?
It has half-wave symmetry: the second half of the cycle is the first half upside down. That cancels all the even harmonics.
What is the Gibbs phenomenon?
Near a sudden jump the series always overshoots by about 9 percent of the jump, however many harmonics you add. The overshoot gets narrower but not smaller.
Why do the harmonics of a triangle wave fall off faster?
Its corners are smoother than the jumps of a square wave, so the harmonic amplitudes fall as one over n squared instead of one over n.
What is total harmonic distortion?
The rms of all the harmonics above the fundamental, divided by the fundamental, as a percent.
Related calculators
Got a question about this? Ask an engineering question and get a plain-language answer with references.
Further reading: Oppenheim and Willsky, Signals and Systems; Kreyszig, Advanced Engineering Mathematics (Fourier series).
Need a calculator we do not have?
Embed this calculator on your own page
Copy this code into your page. The calculator runs inside the frame and links back to Drafting Central.
Need this drawn, designed or checked?
Drafting Central is a mechanical engineering and drafting business working with customers across Australia and around the world. A calculator gives you the numbers; we can turn them into drawings and designs.
Need help with a real project?
Talk to Drafting Central →