Square Wave — Definition, Formula & Example
A square wave is a repeating signal that holds one constant value for half of each cycle, then jumps instantly to the opposite value for the other half. On a graph it looks like a row of flat-topped blocks that alternate above and below the axis.
For amplitude and period , the square wave is the -periodic function with for and for . Equivalently, . It is odd and satisfies the half-wave symmetry . It has jump discontinuities at integer multiples of , where its Fourier series converges to the midpoint value .
Key Formula
Where:
- = Amplitude: the wave's constant height above or below the axis
- = Period: the length of one full cycle
- = Angular frequency of the fundamental, in radians per unit time
- = Summation index; 2k − 1 runs through the odd harmonics 1, 3, 5, ...
Worked Example
Problem: A signal generator outputs a square wave that switches between +5 V and −5 V. What fraction of the signal's average power is carried by its fundamental sine component alone?
Step 1: Find the mean square of the whole wave. Because at every point except the jumps, the average of over one period is 25, so the RMS value is 5 V.
Step 2: Read the fundamental's amplitude from the formula with and . It is larger than the wave's own height of 5 V.
Step 3: A sine of amplitude has mean square . Divide this by the total mean square from Step 1.
Answer: The fundamental carries , or about 81.1%, of the average power. The odd harmonics 3, 5, 7, ... carry the remaining 18.9%.
Why It Matters
Square waves serve as clock signals in digital circuits and as the drive signal of PWM motor controllers. Engineers use the result above to filter a square wave into a nearly pure sine wave. Removing the 3rd, 5th, and higher harmonics leaves a signal that keeps about 81% of the original power.
Common Mistakes
Mistake: Including even harmonics such as or in the series, or assuming the fundamental's amplitude equals .
Correction: The half-wave symmetry forces every even-harmonic coefficient to equal zero, so only odd harmonics appear. The fundamental's amplitude is , which is larger than . The higher harmonics partly cancel it to produce the flat tops.
