Triangle wave
   HOME

TheInfoList



OR:

A triangular wave or triangle wave is a non-sinusoidal waveform named for its triangular shape. It is a periodic, piecewise linear, continuous
real function In mathematical analysis, and applications in geometry, applied mathematics, engineering, and natural sciences, a function of a real variable is a function whose domain is the real numbers \mathbb, or a subset of \mathbb that contains an inter ...
. Like a
square wave Square wave may refer to: *Square wave (waveform) A square wave is a non-sinusoidal waveform, non-sinusoidal periodic waveform in which the amplitude alternates at a steady frequency between fixed minimum and maximum values, with the same ...
, the triangle wave contains only odd
harmonic In physics, acoustics, and telecommunications, a harmonic is a sinusoidal wave with a frequency that is a positive integer multiple of the ''fundamental frequency'' of a periodic signal. The fundamental frequency is also called the ''1st har ...
s. However, the higher harmonics roll off much faster than in a square wave (proportional to the inverse square of the harmonic number as opposed to just the inverse).


Definitions


Definition

A triangle wave of period ''p'' that spans the range , 1is defined as x(t) = 2 \left, \frac - \left\lfloor \frac + \frac \right\rfloor \, where \lfloor\ \rfloor is the
floor function In mathematics, the floor function is the function that takes as input a real number , and gives as output the greatest integer less than or equal to , denoted or . Similarly, the ceiling function maps to the least integer greater than or eq ...
. This can be seen to be the absolute value of a shifted
sawtooth wave The sawtooth wave (or saw wave) is a kind of non-sinusoidal waveform. It is so named based on its resemblance to the teeth of a plain-toothed saw with a zero rake angle. A single sawtooth, or an intermittently triggered sawtooth, is called a ...
. For a triangle wave spanning the range the expression becomes x(t)= 2 \left , 2 \left( \frac - \left\lfloor \frac + \frac \right\rfloor \right) \ - 1. A more general equation for a triangle wave with amplitude a and period p using the
modulo operation In computing and mathematics, the modulo operation returns the remainder or signed remainder of a Division (mathematics), division, after one number is divided by another, the latter being called the ''modular arithmetic, modulus'' of the operatio ...
and
absolute value In mathematics, the absolute value or modulus of a real number x, is the non-negative value without regard to its sign. Namely, , x, =x if x is a positive number, and , x, =-x if x is negative (in which case negating x makes -x positive), ...
is y(x) = \frac \left, \left( \left(x - \frac\right) \bmod p \right) - \frac \ - a. For example, for a triangle wave with amplitude 5 and period 4: y(x) = 5 \left, \bigl( (x - 1) \bmod 4 \bigr) - 2 \ - 5. A phase shift can be obtained by altering the value of the -p/4 term, and the vertical offset can be adjusted by altering the value of the -a term. As this only uses the modulo operation and absolute value, it can be used to simply implement a triangle wave on hardware electronics. Note that in many programming languages, the % operator is a remainder operator (with result the same sign as the dividend), not a
modulo operator In computing and mathematics, the modulo operation returns the remainder or signed remainder of a division, after one number is divided by another, the latter being called the '' modulus'' of the operation. Given two positive numbers and , mod ...
; the modulo operation can be obtained by using ((x % p) + p) % p in place of x % p. In e.g. JavaScript, this results in an equation of the form 4*a/p * Math.abs((((x - p/4) % p) + p) % p - p/2) - a.


Relation to the square wave

The triangle wave can also be expressed as the
integral In mathematics, an integral is the continuous analog of a Summation, sum, which is used to calculate area, areas, volume, volumes, and their generalizations. Integration, the process of computing an integral, is one of the two fundamental oper ...
of the
square wave Square wave may refer to: *Square wave (waveform) A square wave is a non-sinusoidal waveform, non-sinusoidal periodic waveform in which the amplitude alternates at a steady frequency between fixed minimum and maximum values, with the same ...
: x(t) = \int_0^t \sgn\left(\sin\frac\right)\,du.


Expression in trigonometric functions

A triangle wave with period ''p'' and amplitude ''a'' can be expressed in terms of
sine In mathematics, sine and cosine are trigonometric functions of an angle. The sine and cosine of an acute angle are defined in the context of a right triangle: for the specified angle, its sine is the ratio of the length of the side opposite th ...
and
arcsine In mathematics, the inverse trigonometric functions (occasionally also called ''antitrigonometric'', ''cyclometric'', or ''arcus'' functions) are the inverse functions of the trigonometric functions, under suitably restricted domains. Specific ...
(whose value ranges from −''π''/2 to ''π''/2): y(x) = \frac \arcsin\left(\sin\left(\fracx\right)\right). The identity \cos = \sin\left(\frac-x\right) can be used to convert from a triangle "sine" wave to a triangular "cosine" wave. This phase-shifted triangle wave can also be expressed with
cosine In mathematics, sine and cosine are trigonometric functions of an angle. The sine and cosine of an acute angle are defined in the context of a right triangle: for the specified angle, its sine is the ratio of the length of the side opposite that ...
and
arccosine In mathematics, the inverse trigonometric functions (occasionally also called ''antitrigonometric'', ''cyclometric'', or ''arcus'' functions) are the inverse functions of the trigonometric functions, under suitably restricted domains. Specific ...
: y(x) = a - \frac \arccos\left(\cos\left(\fracx\right)\right).


Expressed as alternating linear functions

Another definition of the triangle wave, with range from −1 to 1 and period ''p'', is x(t) = \frac \left(t - \frac \left\lfloor\frac + \frac \right\rfloor \right)(-1)^\left\lfloor\frac + \frac \right\rfloor.


Harmonics

It is possible to approximate a triangle wave with
additive synthesis Additive synthesis is a sound synthesis technique that creates timbre by adding sine waves together. The timbre of musical instruments can be considered in the light of Fourier series, Fourier theory to consist of multiple harmonic or inharmoni ...
by summing odd harmonics of the fundamental while multiplying every other odd harmonic by −1 (or, equivalently, changing its phase by ) and multiplying the amplitude of the harmonics by one over the square of their mode number, (which is equivalent to one over the square of their relative frequency to the fundamental). The above can be summarised mathematically as follows: x_\text(t) = \frac8 \sum_^ \frac \sin(2\pi f_0 n t), where is the number of harmonics to include in the approximation, is the independent variable (e.g. time for sound waves), f_0 is the fundamental frequency, and is the harmonic label which is related to its mode number by n = 2i + 1. This infinite
Fourier series A Fourier series () is an Series expansion, expansion of a periodic function into a sum of trigonometric functions. The Fourier series is an example of a trigonometric series. By expressing a function as a sum of sines and cosines, many problems ...
converges quickly to the triangle wave as tends to infinity, as shown in the animation.


Arc length

The
arc length Arc length is the distance between two points along a section of a curve. Development of a formulation of arc length suitable for applications to mathematics and the sciences is a problem in vector calculus and in differential geometry. In the ...
per period for a triangle wave, denoted by ''s'', is given in terms of the amplitude ''a'' and period length ''p'' by s = \sqrt.


See also

* List of periodic functions *
Sine wave A sine wave, sinusoidal wave, or sinusoid (symbol: ∿) is a periodic function, periodic wave whose waveform (shape) is the trigonometric function, trigonometric sine, sine function. In mechanics, as a linear motion over time, this is ''simple ...
*
Square wave Square wave may refer to: *Square wave (waveform) A square wave is a non-sinusoidal waveform, non-sinusoidal periodic waveform in which the amplitude alternates at a steady frequency between fixed minimum and maximum values, with the same ...
*
Sawtooth wave The sawtooth wave (or saw wave) is a kind of non-sinusoidal waveform. It is so named based on its resemblance to the teeth of a plain-toothed saw with a zero rake angle. A single sawtooth, or an intermittently triggered sawtooth, is called a ...
* Pulse wave *
Sound In physics, sound is a vibration that propagates as an acoustic wave through a transmission medium such as a gas, liquid or solid. In human physiology and psychology, sound is the ''reception'' of such waves and their ''perception'' by the br ...
*
Triangle function A triangular function (also known as a triangle function, hat function, or tent function) is a function whose graph takes the shape of a triangle. Often this is an isosceles triangle of height 1 and base 2 in which case it is referred to as ''th ...
*
Wave In physics, mathematics, engineering, and related fields, a wave is a propagating dynamic disturbance (change from List of types of equilibrium, equilibrium) of one or more quantities. ''Periodic waves'' oscillate repeatedly about an equilibrium ...
*
Zigzag A zigzag is a pattern made up of small corners at variable angles, though constant within the zigzag, tracing a path between two parallel lines; it can be described as both jagged and fairly regular. In geometry, this pattern is described as a ...


References

* {{DEFAULTSORT:Triangle Wave Fourier series Waveforms