Triangle: $\dfrac{8A}{\pi^2}\sum_{n=0}^{\infty}\dfrac{(-1)^n}{(2n+1)^2}\sin((2n+1)\omega t)$
Sawtooth: $\dfrac{2A}{\pi}\sum_{n=1}^{\infty}\dfrac{(-1)^{n+1}}{n}\sin(n\omega t)$
Mix up to four sine, square, triangle or sawtooth components. Change amplitude, frequency and phase to compare the sampled waveform, RMS, peak, crest factor, approximate THD and spectrum.
TRY THE SAME CONDITIONS
Enable only component 1: sine, A=1.0 (amplitude input 10), 50Hz and phase 0°. RMS=0.707, peak=1.000, crest factor=1.414 and THD=0.0%. Add an identical component at 180° to see cancellation.
Calculator ↑The time record has 512 samples over two periods of the lowest enabled frequency. Square and triangle waves use 20 odd harmonics; sawtooth uses 20 harmonics. The spectrum uses a 64-point DFT after 8:1 decimation. Approximate THD takes the strongest component as its reference and checks multiples 2–8.
The input uses a factor-of-ten scale: 10 means A=1.0 and 100 means A=10.0. No physical amplitude unit is imposed. If interpreting it as voltage, use that same unit for the waveform and RMS.
A finite harmonic series approximates a discontinuity with overshoot. The sampled approximation therefore need not have the ideal square wave's peak or RMS.
Spectrum decimation has no antialiasing filter, so harmonics can fold back. The plot is also limited to 600Hz. Do not treat it as a precision spectrum analyzer or THD measurement.
Yes, but components containing a noninteger number of cycles in the observation window produce spectral leakage. Phase and window length affect the sampled metrics. Start with integer multiples to understand the display.
Theory reference (not certification of this tool)
NI: Sampling and aliasingExplanation updated: 6 September 2026