Fourier Series

Approximate a periodic function with harmonics

One period of the wave. Use x with + − * / ^ and functions like sin, cos, sign, abs, exp. Example: sign(sin(x)) is a square wave.

The length of one full cycle. 2π ≈ 6.2832 for the standard trig waves.

How many sine/cosine terms to sum. A whole number from 1 to 50.

Compare the partial sum to the true value here. Leave blank to skip.

f(x) ≈ 1.27324sin(ωx) + 0.424413sin(3ωx) + 0.254648sin(5ωx)
Mean a₀/2 (DC term)
0
Fundamental ω = 2π/P
1
Harmonics N
5
Fourier partial sum Sₙ(x)
1.27324sin(ωx) + 0.424413sin(3ωx) + 0.254648sin(5ωx)
Harmonic coefficients
naₙ (cos)bₙ (sin)Aₙ = √(aₙ²+bₙ²)φₙ (rad)
101.27323954471.27323954471.5707963268
20000
300.42441318160.42441318161.5707963268
40000
500.2546479090.2546479091.5707963268
One period of f(x) drawn solid with its N-harmonic Fourier partial sum dashed on top; adding harmonics pulls the dashed curve onto f, overshooting near jumps (the Gibbs phenomenon). f(x) = sign(sin(x)), N = 5.One period of f(x) drawn solid with its N-harmonic Fourier partial sum dashed on top; adding harmonics pulls the dashed curve onto f, overshooting near jumps (the Gibbs phenomenon). f(x) = sign(sin(x)), N = 5.xy-3-2-1123-1.5-1-0.50.511.5
f(x)Sₙ(x)