Triangle wave
   HOME

TheInfoList



OR:

A triangular wave or triangle wave is a non-sinusoidal waveform named for its
triangular A triangle is a polygon with three edges and three vertices. It is one of the basic shapes in geometry. A triangle with vertices ''A'', ''B'', and ''C'' is denoted \triangle ABC. In Euclidean geometry, any three points, when non- collinea ...
shape. It is a periodic, piecewise linear,
continuous Continuity or continuous may refer to: Mathematics * Continuity (mathematics), the opposing concept to discreteness; common examples include ** Continuous probability distribution or random variable in probability and statistics ** 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 interv ...
. Like a
square wave A square wave is a non-sinusoidal periodic waveform in which the amplitude alternates at a steady frequency between fixed minimum and maximum values, with the same duration at minimum and maximum. In an ideal square wave, the transitions b ...
, the triangle wave contains only odd
harmonic A harmonic is a wave with a frequency that is a positive integer multiple of the ''fundamental frequency'', the frequency of the original periodic signal, such as a sinusoidal wave. The original signal is also called the ''1st harmonic'', the ...
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 and computer science, 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 int ...
. 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 + \right \rfloor \right) \right , - 1. A more general equation for a triangle wave with amplitude a and period p using the
modulo operation In computing, the modulo operation returns the remainder or signed remainder of a division, after one number is divided by another (called the '' modulus'' of the operation). Given two positive numbers and , modulo (often abbreviated as ) is th ...
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 is a positive number, and , x, =-x if x is negative (in which case negating x makes -x positive), an ...
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 \bigl , \left( (x - 1) \bmod 4 \right) - 2\bigr , - 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, the modulo operation returns the remainder or signed remainder of a division, after one number is divided by another (called the '' modulus'' of the operation). Given two positive numbers and , modulo (often abbreviated as ) is th ...
; 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 Mathematics is an area of knowledge that includes the topics of numbers, formulas and related structures, shapes and the spaces in which they are contained, and quantities and their changes. These topics are represented i ...
of the
square wave A square wave is a non-sinusoidal periodic waveform in which the amplitude alternates at a steady frequency between fixed minimum and maximum values, with the same duration at minimum and maximum. In an ideal square wave, the transitions b ...
: 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 that is oppo ...
and
arcsine In mathematics, the inverse trigonometric functions (occasionally also called arcus functions, antitrigonometric functions or cyclometric functions) are the inverse functions of the trigonometric functions (with suitably restricted domains). Spec ...
(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 and
arccosine In mathematics, the inverse trigonometric functions (occasionally also called arcus functions, antitrigonometric functions or cyclometric functions) are the inverse functions of the trigonometric functions (with suitably restricted Domain of a fu ...
: 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 Fundamental may refer to: * Foundation of reality * Fundamental frequency, as in music or phonetics, often referred to as simply a "fundamental" * Fundamentalism, the belief in, and usually the strict adherence to, the simple or "fundamental" idea ...
). The above can be summarised mathematically as follows: \begin x_\mathrm(t) & = \frac8\sum_^ (-1)^i n^ \sin\left(2\pi f_0 n t\right) \end 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 a summation of harmonically related sinusoidal functions, also known as components or harmonics. The result of the summation is a periodic function whose functional form is determined by the choices of cycle length (or ''p ...
converges quickly to the triangle wave as tends to infinity, as shown in the animation.


Arc length

The
arc length ARC may refer to: Business * Aircraft Radio Corporation, a major avionics manufacturer from the 1920s to the '50s * Airlines Reporting Corporation, an airline-owned company that provides ticket distribution, reporting, and settlement services * ...
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 This is a list of some well-known periodic functions. The constant function , where is independent of , is periodic with any period, but lacks a ''fundamental period''. A definition is given for some of the following functions, though each funct ...
*
Sine wave A sine wave, sinusoidal wave, or just sinusoid is a curve, mathematical curve defined in terms of the ''sine'' trigonometric function, of which it is the graph of a function, graph. It is a type of continuous wave and also a Smoothness, smooth p ...
*
Square wave A square wave is a non-sinusoidal periodic waveform in which the amplitude alternates at a steady frequency between fixed minimum and maximum values, with the same duration at minimum and maximum. In an ideal square wave, the transitions b ...
*
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 A pulse wave or pulse train is a type of non-sinusoidal waveform that includes square waves (duty cycle of 50%) and similarly periodic but asymmetrical waves (duty cycles other than 50%). It is a term used in synthesizer programming, and is ...
*
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 ...
*
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, and related fields, a wave is a propagating dynamic disturbance (change from equilibrium) of one or more quantities. Waves can be periodic, in which case those quantities oscillate repeatedly about an equilibrium (res ...
*
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