Square wave

Last updated

Square wave
Waveforms.svg
Sine, square, triangle, and sawtooth waveforms
General information
General definition
Fields of applicationElectronics, synthesizers
Domain, codomain and image
Domain
Codomain
Basic features
Parity Odd
Period 1
Antiderivative Triangle wave
Fourier series

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 between minimum and maximum are instantaneous.

Contents

The square wave is a special case of a pulse wave which allows arbitrary durations at minimum and maximum amplitudes. The ratio of the high period to the total period of a pulse wave is called the duty cycle. A true square wave has a 50% duty cycle (equal high and low periods).

Square waves are often encountered in electronics and signal processing, particularly digital electronics and digital signal processing. Its stochastic counterpart is a two-state trajectory.

Origin and uses

Square waves are universally encountered in digital switching circuits and are naturally generated by binary (two-level) logic devices. They are used as timing references or "clock signals", because their fast transitions are suitable for triggering synchronous logic circuits at precisely determined intervals. However, as the frequency-domain graph shows, square waves contain a wide range of harmonics; these can generate electromagnetic radiation or pulses of current that interfere with other nearby circuits, causing noise or errors. To avoid this problem in very sensitive circuits such as precision analog-to-digital converters, sine waves are used instead of square waves as timing references.

In musical terms, they are often described as sounding hollow, and are therefore used as the basis for wind instrument sounds created using subtractive synthesis. They also make up the "beeping" alerts used in many household, commercial, and industrial contexts. Additionally, the distortion effect used on electric guitars clips the outermost regions of the waveform, causing it to increasingly resemble a square wave as more distortion is applied.

Simple two-level Rademacher functions are square waves.

Definitions

The square wave in mathematics has many definitions, which are equivalent except at the discontinuities:

It can be defined as simply the sign function of a sinusoid:

which will be 1 when the sinusoid is positive, −1 when the sinusoid is negative, and 0 at the discontinuities. Here, T is the period of the square wave and f is its frequency, which are related by the equation f = 1/T.

A square wave can also be defined with respect to the Heaviside step function u(t) or the rectangular function Π(t):

A square wave can also be generated using the floor function directly:

and indirectly:

Using the fourier series (below) one can show that the floor function may be written in trigonometric form [1]

Fourier analysis

The six arrows represent the first six terms of the Fourier series of a square wave. The two circles at the bottom represent the exact square wave (blue) and its Fourier-series approximation (purple). SquareWaveFourierArrows.gif
The six arrows represent the first six terms of the Fourier series of a square wave. The two circles at the bottom represent the exact square wave (blue) and its Fourier-series approximation (purple).
(Odd) harmonics of a 1000 Hz square wave Spectrum square oscillation.jpg
(Odd) harmonics of a 1000 Hz square wave
Graph showing the first 3 terms of the Fourier series of a square wave Fourier Series-Square wave 3 H.png
Graph showing the first 3 terms of the Fourier series of a square wave

Using Fourier expansion with cycle frequency f over time t, an ideal square wave with an amplitude of 1 can be represented as an infinite sum of sinusoidal waves:

The ideal square wave contains only components of odd-integer harmonic frequencies (of the form 2π(2k − 1)f).

A curiosity of the convergence of the Fourier series representation of the square wave is the Gibbs phenomenon. Ringing artifacts in non-ideal square waves can be shown to be related to this phenomenon. The Gibbs phenomenon can be prevented by the use of σ-approximation, which uses the Lanczos sigma factors to help the sequence converge more smoothly.

An ideal mathematical square wave changes between the high and the low state instantaneously, and without under- or over-shooting. This is impossible to achieve in physical systems, as it would require infinite bandwidth.

Animation of the additive synthesis of a square wave with an increasing number of harmonics Fourier series for square wave.gif
Animation of the additive synthesis of a square wave with an increasing number of harmonics

Square waves in physical systems have only finite bandwidth and often exhibit ringing effects similar to those of the Gibbs phenomenon or ripple effects similar to those of the σ-approximation.

For a reasonable approximation to the square-wave shape, at least the fundamental and third harmonic need to be present, with the fifth harmonic being desirable. These bandwidth requirements are important in digital electronics, where finite-bandwidth analog approximations to square-wave-like waveforms are used. (The ringing transients are an important electronic consideration here, as they may go beyond the electrical rating limits of a circuit or cause a badly positioned threshold to be crossed multiple times.)

Characteristics of imperfect square waves

As already mentioned, an ideal square wave has instantaneous transitions between the high and low levels. In practice, this is never achieved because of physical limitations of the system that generates the waveform. The times taken for the signal to rise from the low level to the high level and back again are called the rise time and the fall time respectively.

If the system is overdamped, then the waveform may never actually reach the theoretical high and low levels, and if the system is underdamped, it will oscillate about the high and low levels before settling down. In these cases, the rise and fall times are measured between specified intermediate levels, such as 5% and 95%, or 10% and 90%. The bandwidth of a system is related to the transition times of the waveform; there are formulas allowing one to be determined approximately from the other.

See also

Related Research Articles

In integral calculus, an elliptic integral is one of a number of related functions defined as the value of certain integrals, which were first studied by Giulio Fagnano and Leonhard Euler. Their name originates from their originally arising in connection with the problem of finding the arc length of an ellipse.

<span class="mw-page-title-main">Trigonometric functions</span> Functions of an angle

In mathematics, the trigonometric functions are real functions which relate an angle of a right-angled triangle to ratios of two side lengths. They are widely used in all sciences that are related to geometry, such as navigation, solid mechanics, celestial mechanics, geodesy, and many others. They are among the simplest periodic functions, and as such are also widely used for studying periodic phenomena through Fourier analysis.

<span class="mw-page-title-main">Sawtooth wave</span> Non-sinusoidal waveform

The sawtooth 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 ramp waveform.

<span class="mw-page-title-main">Triangle wave</span> Non-sinusoidal waveform

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.

<span class="mw-page-title-main">Hyperbolic functions</span> Collective name of 6 mathematical functions

In mathematics, hyperbolic functions are analogues of the ordinary trigonometric functions, but defined using the hyperbola rather than the circle. Just as the points (cos t, sin t) form a circle with a unit radius, the points (cosh t, sinh t) form the right half of the unit hyperbola. Also, similarly to how the derivatives of sin(t) and cos(t) are cos(t) and –sin(t) respectively, the derivatives of sinh(t) and cosh(t) are cosh(t) and +sinh(t) respectively.

<span class="mw-page-title-main">Fourier series</span> Decomposition of periodic functions into sums of simpler sinusoidal forms

A Fourier series is an expansion of a periodic function into a sum of trigonometric functions. The Fourier series is an example of a trigonometric series, but not all trigonometric series are Fourier series. By expressing a function as a sum of sines and cosines, many problems involving the function become easier to analyze because trigonometric functions are well understood. For example, Fourier series were first used by Joseph Fourier to find solutions to the heat equation. This application is possible because the derivatives of trigonometric functions fall into simple patterns. Fourier series cannot be used to approximate arbitrary functions, because most functions have infinitely many terms in their Fourier series, and the series do not always converge. Well-behaved functions, for example smooth functions, have Fourier series that converge to the original function. The coefficients of the Fourier series are determined by integrals of the function multiplied by trigonometric functions, described in Common forms of the Fourier series below.

<span class="mw-page-title-main">Error function</span> Sigmoid shape special function

In mathematics, the error function, often denoted by erf, is a function defined as:

Integration is the basic operation in integral calculus. While differentiation has straightforward rules by which the derivative of a complicated function can be found by differentiating its simpler component functions, integration does not, so tables of known integrals are often useful. This page lists some of the most common antiderivatives.

<span class="mw-page-title-main">Fresnel integral</span> Special function defined by an integral

The Fresnel integralsS(x) and C(x) are two transcendental functions named after Augustin-Jean Fresnel that are used in optics and are closely related to the error function (erf). They arise in the description of near-field Fresnel diffraction phenomena and are defined through the following integral representations:

<span class="mw-page-title-main">Sine wave</span> Wave shaped like the sine function

A sine wave, sinusoidal wave, or sinusoid is a periodic wave whose waveform (shape) is the trigonometric sine function. In mechanics, as a linear motion over time, this is simple harmonic motion; as rotation, it corresponds to uniform circular motion. Sine waves occur often in physics, including wind waves, sound waves, and light waves, such as monochromatic radiation. In engineering, signal processing, and mathematics, Fourier analysis decomposes general functions into a sum of sine waves of various frequencies, relative phases, and magnitudes.

<span class="mw-page-title-main">Inverse trigonometric functions</span> Inverse functions of sin, cos, tan, etc.

In mathematics, the inverse trigonometric functions are the inverse functions of the trigonometric functions. Specifically, they are the inverses of the sine, cosine, tangent, cotangent, secant, and cosecant functions, and are used to obtain an angle from any of the angle's trigonometric ratios. Inverse trigonometric functions are widely used in engineering, navigation, physics, and geometry.

The Basel problem is a problem in mathematical analysis with relevance to number theory, concerning an infinite sum of inverse squares. It was first posed by Pietro Mengoli in 1650 and solved by Leonhard Euler in 1734, and read on 5 December 1735 in The Saint Petersburg Academy of Sciences. Since the problem had withstood the attacks of the leading mathematicians of the day, Euler's solution brought him immediate fame when he was twenty-eight. Euler generalised the problem considerably, and his ideas were taken up more than a century later by Bernhard Riemann in his seminal 1859 paper "On the Number of Primes Less Than a Given Magnitude", in which he defined his zeta function and proved its basic properties. The problem is named after Basel, hometown of Euler as well as of the Bernoulli family who unsuccessfully attacked the problem.

<span class="mw-page-title-main">Sinc function</span> Special mathematical function defined as sin(x)/x

In mathematics, physics and engineering, the sinc function, denoted by sinc(x), has two forms, normalized and unnormalized.

<span class="mw-page-title-main">Dirichlet integral</span> Integral of sin(x)/x from 0 to infinity.

In mathematics, there are several integrals known as the Dirichlet integral, after the German mathematician Peter Gustav Lejeune Dirichlet, one of which is the improper integral of the sinc function over the positive real line:

<span class="mw-page-title-main">Phasor</span> Complex number representing a particular sine wave

In physics and engineering, a phasor is a complex number representing a sinusoidal function whose amplitude, and initial phase are time-invariant and whose angular frequency is fixed. It is related to a more general concept called analytic representation, which decomposes a sinusoid into the product of a complex constant and a factor depending on time and frequency. The complex constant, which depends on amplitude and phase, is known as a phasor, or complex amplitude, and sinor or even complexor.

<span class="mw-page-title-main">Pulse wave</span> Periodic rectangular waveform

A pulse wave or pulse train or rectangular wave is a non-sinusoidal waveform that is the periodic version of the rectangular function. It is held high a percent each cycle (period) called the duty cycle and for the remainder of each cycle is low. A duty cycle of 50% produces a square wave, a specific case of a rectangular wave. The average level of a rectangular wave is also given by the duty cycle.

<span class="mw-page-title-main">Hyperbolic secant distribution</span> Continuous probability distribution

In probability theory and statistics, the hyperbolic secant distribution is a continuous probability distribution whose probability density function and characteristic function are proportional to the hyperbolic secant function. The hyperbolic secant function is equivalent to the reciprocal hyperbolic cosine, and thus this distribution is also called the inverse-cosh distribution.

atan2 Arctangent function with two arguments

In computing and mathematics, the function atan2 is the 2-argument arctangent. By definition, is the angle measure between the positive -axis and the ray from the origin to the point in the Cartesian plane. Equivalently, is the argument of the complex number

References

  1. "Partial sum formula". www.wolframalpha.com. Archived from the original on 22 January 2023. Retrieved 9 July 2023.