HOME
The Info List - Square Wave


--- Advertisement ---



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. Although not realizable in physical systems, the transition between minimum and maximum is instantaneous for an ideal square wave. The square wave is a special case of a pulse wave which allows arbitrary durations at minimum and maximum. 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. Its stochastic counterpart is a two-state trajectory.

Contents

1 Origin and uses 2 Definitions 3 Fourier analysis 4 Characteristics of imperfect square waves 5 See also 6 External links

Origin and uses[edit] 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. 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[edit] 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:

x ( t )

= sgn ⁡

(

sin ⁡

t T

)

= sgn ⁡ ( sin ⁡ f t )

v ( t )

= sgn ⁡

(

cos ⁡

t T

)

= sgn ⁡ ( cos ⁡ f t ) ,

displaystyle begin aligned x(t)&=operatorname sgn left(sin frac t T right)=operatorname sgn (sin ft)\v(t)&=operatorname sgn left(cos frac t T right)=operatorname sgn (cos ft),end aligned

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, or equivalently, f is its frequency, where f = 1/T. A square wave can also be defined with respect to the Heaviside step function u(t) or the rectangular function Π(t):

x ( t )

= 2

[

n = − ∞

Π

(

2 ( t − n T )

T

1 2

)

]

− 1

= 2

n = − ∞

[

u

(

t T

− n

)

− u

(

t T

− n −

1 2

)

]

− 1.

displaystyle begin aligned x(t)&=2left[sum _ n=-infty ^ infty Pi left( frac 2(t-nT) T - frac 1 2 right)right]-1\&=2sum _ n=-infty ^ infty left[uleft( frac t T -nright)-uleft( frac t T -n- frac 1 2 right)right]-1.end aligned

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

x ( t ) =

(

2 ⌊ f t ⌋ − ⌊ 2 f t ⌋ + 1

)

displaystyle x(t)=left(2lfloor ftrfloor -lfloor 2ftrfloor +1right)

and indirectly:

x ( t ) =

(

− 1

)

⌊ f t ⌋

.

displaystyle x(t)=left(-1right)^ lfloor ftrfloor .

Fourier analysis [edit]

The six arrows represent the first six terms of the Fourier series
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

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:

x ( t )

=

4 π

k = 1

sin ⁡

(

2 π ( 2 k − 1 ) f t

)

2 k − 1

=

4 π

(

sin ⁡ ( 2 π f t ) +

1 3

sin ⁡ ( 6 π f t ) +

1 5

sin ⁡ ( 10 π f t ) + ⋯

)

.

displaystyle begin aligned x(t)&= frac 4 pi sum _ k=1 ^ infty frac sin left(2pi (2k-1)ftright) 2k-1 \&= frac 4 pi left(sin(2pi ft)+ frac 1 3 sin(6pi ft)+ frac 1 5 sin(10pi ft)+cdots right).end aligned

Additive square demo

220 Hz square wave created by harmonics added every second over sine wave

Problems playing this file? See media help.

The ideal square wave contains only components of odd-integer harmonic frequencies (of the form 2π(2k − 1)f). Sawtooth waves and real-world signals contain all integer harmonics. A curiosity of the convergence of the Fourier series
Fourier series
representation of the square wave is the Gibbs phenomenon. Ringing artifacts
Ringing artifacts
in non-ideal square waves can be shown to be related to this phenomenon. The Gibbs phenomenon
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

Square waves in physical systems have only finite bandwidth and often exhibit ringing effects similar to those of the Gibbs phenomenon
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.)

Square wave
Square wave
sound sample

5 seconds of square wave at 1 kHz

Problems playing this file? See media help.

Characteristics of imperfect square waves[edit] 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[edit]

List of periodic functions Rectangular function Pulse wave Sine wave Triangle wave Sawtooth wave Waveform Sound Multivibrator Ronchi ruling, a square-wave stripe target used in imaging.

External links[edit]

Square Wave Approximated by Sines Interactive demo of square wave synthesis using sine waves. Flash applets Square wave.

v t e

Waveforms

Sine wave Non-sinusoidal

Rectangular wave Sawtooth wave Square

.

Time at 25410174.25, Busy percent: 30
***************** NOT Too Busy at 25410174.25 3../logs/periodic-service_log.txt
1440 = task['interval'];
25411346.483333 = task['next-exec'];
25409906.483333 = task['last-exec'];
daily-work.php = task['exec'];
25410174.25 Time.

10080 = task['interval'];
25418546.516667 = task['next-exec'];
25408466.516667 = task['last-exec'];
weekly-work.php = task['exec'];
25410174.25 Time.

1440 = task['interval'];
25411346.666667 = task['next-exec'];
25409906.666667 = task['last-exec'];
PeriodicStats.php = task['exec'];
25410174.25 Time.

1440 = task['interval'];
25411346.7 = task['next-exec'];
25409906.7 = task['last-exec'];
PeriodicBuild.php = task['exec'];
25410174.25 Time.

1440 = task['interval'];
25411346.716667 = task['next-exec'];
25409906.716667 = task['last-exec'];
cleanup.php = task['exec'];
25410174.25 Time.

1440 = task['interval'];
25411346.933333 = task['next-exec'];
25409906.933333 = task['last-exec'];
build-sitemap-xml.php = task['exec'];
25410174.25 Time.