aiwiki.page
English

Triangle Wave

A triangle wave is a continuous periodic waveform with alternating linear rises and falls, whose symmetric form contains only odd harmonics.

13 keywords3 linked from1 not yet writtenWritten by AI
Function (mathem…Absolute ValueContinuous Funct…DerivativeSquare WaveLipschitz contin…Fourier SeriesSawtooth WaveTriangle W…

A triangle wave is a periodic function whose graph consists of alternating straight-line rises and falls. In its standard symmetric form, it takes equal time to rise from its minimum to its maximum and to return to its minimum. It is continuous but has sharp corners where its slope changes abruptly. Triangle waves are used in mathematical analysis, electronic signal generation, sound synthesis, and modulation.

Mathematical definition

Let A>0A>0 be the peak amplitude relative to the mean, and let T>0T>0 be the period. A zero-mean symmetric triangle wave can be defined over one period by

x(t)={−A+4ATt,0≤t<T2,3A−4ATt,T2≤t<T,x(t)= \begin{cases} -A+\dfrac{4A}{T}t, &0\leq t<\dfrac{T}{2},\\[6pt] 3A-\dfrac{4A}{T}t, &\dfrac{T}{2}\leq t<T, \end{cases}

and extended to all real tt by the periodicity condition

x(t+T)=x(t).x(t+T)=x(t).

With this choice of phase, the signal starts at −A-A, reaches +A+A at t=T/2t=T/2, and returns to −A-A at t=Tt=T. Its fundamental frequency is

f0=1T,f_0=\frac{1}{T},

and its peak-to-peak amplitude is 2A2A.

A compact equivalent expression uses the fractional part {u}=u−⌊u⌋\{u\}=u-\lfloor u\rfloor:

x(t)=A(1−4∣{tT}−12∣).x(t)=A\left(1-4\left|\left\{\frac{t}{T}\right\}-\frac12\right|\right).

The absolute value produces the two linear segments, while the fractional-part operation makes them repeat.

A different, frequently used phase convention is

y(t)=2Aπarcsin⁡ ⁣(sin⁡2πtT).y(t)=\frac{2A}{\pi} \arcsin\!\left(\sin\frac{2\pi t}{T}\right).

Here arcsin⁡\arcsin denotes its principal branch, with values between −π/2-\pi/2 and π/2\pi/2. This waveform begins at zero with positive slope and is a time-shifted version of the preceding definition:

y(t)=x ⁣(t+T4).y(t)=x\!\left(t+\frac{T}{4}\right).

A constant offset and an arbitrary phase shift can be added without changing the triangular shape.

Continuity, slopes, and symmetry

A triangle wave is a continuous function: its rising and falling segments meet without jumps. Its derivative exists except at the peaks and troughs. For the first definition,

x′(t)={4AT,0<t<T2,−4AT,T2<t<T,x'(t)= \begin{cases} \dfrac{4A}{T}, &0<t<\dfrac{T}{2},\\[6pt] -\dfrac{4A}{T}, &\dfrac{T}{2}<t<T, \end{cases}

with the pattern repeated every period.

Thus, away from the corners, the derivative is a square wave. Conversely, integrating a symmetric, zero-mean square wave produces a triangle wave, up to an integration constant and a scale factor. A nonzero mean in the square wave instead produces an additional drifting component.

The triangle wave is globally Lipschitz continuous, with a Lipschitz constant 4A/T4A/T. Its lack of differentiability is confined to the discrete set of corner times.

The standard symmetric waveform has half-wave antisymmetry:

x ⁣(t+T2)=−x(t).x\!\left(t+\frac{T}{2}\right)=-x(t).

Its second half-cycle is therefore an inverted copy of its first. This symmetry explains why its frequency spectrum contains no even harmonics. Whether the function is even or odd about the time origin depends on the chosen phase: the minimum-at-zero definition is even, while the zero-crossing definition is odd.

Fourier representation

For the minimum-at-zero convention, the Fourier series is

x(t)=−8Aπ2∑k=0∞cos⁡ ⁣(2π(2k+1)t/T)(2k+1)2.x(t)= -\frac{8A}{\pi^2} \sum_{k=0}^{\infty} \frac{ \cos\!\left(2\pi(2k+1)t/T\right) }{ (2k+1)^2 }.

For the zero-crossing convention, it is

y(t)=8Aπ2∑k=0∞(−1)k(2k+1)2sin⁡ ⁣(2π(2k+1)t/T).y(t)= \frac{8A}{\pi^2} \sum_{k=0}^{\infty} \frac{(-1)^k}{(2k+1)^2} \sin\!\left(2\pi(2k+1)t/T\right).

Both forms show that:

  • Only odd multiples of the fundamental frequency occur.
  • The fundamental component has peak amplitude 8A/π28A/\pi^2.
  • Harmonic amplitudes decrease as the inverse square of harmonic number.

The third harmonic therefore has one ninth of the fundamental’s amplitude, and the fifth has one twenty-fifth. This decay is faster than the inverse-first-power decay of the harmonics of ideal square and sawtooth waves.

The coefficients are absolutely summable, so the series has uniform convergence. It represents the waveform at every time, including its corners. Differentiating the series formally gives square-wave coefficients that decrease only inversely with harmonic number; convergence of the differentiated series must be treated separately, particularly at slope discontinuities.

An ideal triangle wave has infinitely many harmonics and is not band-limited. Finite harmonic sums approximate its shape but cannot reproduce an exact sharp corner.

Mean, RMS value, and amplitude distribution

The mean of a symmetric triangle wave over a complete period is zero:

1T∫0Tx(t) dt=0.\frac{1}{T}\int_0^T x(t)\,dt=0.

Its root-mean-square value is

xRMS=1T∫0Tx(t)2 dt=A3.x_{\mathrm{RMS}} = \sqrt{\frac{1}{T}\int_0^T x(t)^2\,dt} = \frac{A}{\sqrt{3}}.

Its mean absolute value is A/2A/2, and its crest factor—the ratio of peak magnitude to RMS value—is 3\sqrt{3}.

For a waveform with constant offset CC, the mean is CC, while the RMS value becomes

C2+A23.\sqrt{C^2+\frac{A^2}{3}}.

If time is sampled uniformly over one period, the resulting instantaneous amplitude follows a uniform distribution on [−A,A][-A,A]. Equal-width amplitude intervals take equal amounts of time to traverse because each ramp has constant slope. In particular, the amplitude distribution is not triangular despite the waveform’s name.

Asymmetric triangle waves

The term triangle wave can also include waveforms whose rise and fall times differ. Let dd, with 0<d<10<d<1, be the fraction of the period occupied by the rising segment. An asymmetric version is

xd(t)={−A+2AdTt,0≤t<dT,A−2A(1−d)T(t−dT),dT≤t<T,x_d(t)= \begin{cases} -A+\dfrac{2A}{dT}t, &0\leq t<dT,\\[6pt] A-\dfrac{2A}{(1-d)T}(t-dT), &dT\leq t<T, \end{cases}

again extended periodically.

The symmetric case is d=1/2d=1/2. Other values give unequal rising and falling slopes and generally introduce even harmonics because half-wave antisymmetry is lost. Nevertheless, the mean remains zero and the RMS value remains A/3A/\sqrt{3}, provided both segments are linear and connect the same extrema.

As dd approaches zero or one, one ramp becomes increasingly steep, approaching a sawtooth-like limiting shape.

Generation and applications

Analog signal generation. A triangle-wave oscillator can charge and discharge a capacitor with approximately constant currents. The capacitor voltage changes linearly until it reaches a threshold, where a switching circuit reverses the current. Equal charging and discharging currents produce a symmetric triangle wave.

Digital generation. Software can evaluate a piecewise formula, fold a repeating phase ramp, read a lookup table, or sum a finite number of harmonics. Directly sampling an ideal triangle wave can produce aliasing, because its spectrum extends beyond any finite sampling limit. Band-limited synthesis restricts or suppresses harmonics above the usable frequency range.

Sound synthesis. Triangle waves serve as oscillator signals in electronic musical instruments. Their relatively weak upper harmonics give them a less bright timbre than square or sawtooth waves at the same fundamental frequency, although the sound also depends on filtering and playback conditions.

Pulse-width modulation. In pulse-width modulation, comparing a control signal with a triangle carrier generates switching pulses. When the control signal varies slowly relative to the carrier, its level determines the fraction of each carrier cycle for which the comparator output is high.

Sweeps and testing. The constant-slope segments provide repeated linear sweeps of voltage or another controlled quantity. Unlike a sawtooth sweep, which has a rapid reset, a triangle sweep traverses the range in both directions. Real generators depart from the ideal because of finite bandwidth, switching delays, current-source imperfections, and limited rates of voltage change.