Professional Documents
Culture Documents
Turner
Recursive Discrete-Time
Sinusoidal Oscillators
Matrix Derivation of
simple overlying theory has not been form” implementation. If the value θ
is viewed as a step angle, then we can
Oscillator Properties
presented that unifies all of the vari-
ous oscillator structures and can easily immediately see how this formula can Now we desire to find a general
allow one to look for other potential be used to calculate the next sample of enough process that can be used to ex-
oscillator structures. We can find a sinusoid given two known samples press both the biquad and the coupled
spaced θ apart and a step factor which form equations. First we will denote
some guidance for our quest by first
is just 2 cos(θ). To see how this can be the two past values (these are actually
examining classical oscillators.
used for iterative generation of a sinu- called state variables) as x1 and x 2
The German physicist Heinrich
soid, just view the formula as follows: and their “hatted” versions as the new
Barkhausen, during the early 1900s, values. Plus we notice that the update
formulated the necessary require- NextCos = 2 cos(θ) equations are linear for both forms, so
ments for oscillation. He modeled an we can write them in terms of matrix
× CurrentCos − LastCos.
oscillator as an amplifier with its out- multiplication.
put fed back to its input via a (2)
The matrix form of the update iter-
phase-shifting network. From this ation for the biquad is
model, he deduced and stated two Instead of using a single equation
necessary conditions for oscillation. for a recurrence relation, a pair of trig-
onometric formulas may be used. An x$ 1 2 cos(θ) −1 x1
The Barkhausen criteria, as they are x$ = 1 .
example that can be used to recur- 2 0 x 2
now known, require the total loop (4)
sively generate sinusoids is
gain to be equal to one and the total
loop phase shift needs to be a multiple Likewise the coupled form’s up-
cos(ϕ + θ) = cos(ϕ) cos(θ)
of 2π radians. So, if we are to unify date iteration is written as
− sin(ϕ)sin(θ)
discrete-time oscillator designs into a
single theory, we need to find the dis- sin(ϕ + θ) = cos(ϕ)sin(θ) x$ 1 cos(θ) sin(θ) x1
crete-time equivalent of the + sin(ϕ) cos(θ). x$ = − sin(θ) cos(θ) x .
(3) 2 2 (5)
Barkhausen criteria and use it to de-
velop our theory. We will refer to this as the “coupled” The interpretation of the matrix it-
But first, we will look at how some form. The coupling is evident in that eration is that the column vector on
very old trigonometric formulas, each equation uses not only its past the right-hand side contains the old
viewed in a not so usual way, can be value but also the past value produced state values, and when they are multi-
utilized for sinusoidal generation. by the other equation. Again θ is used plied by the rotation matrix, you get a
Several oscillators have been designed as the step angle per iteration, and this new set of state values. Then for the
via this approach. A sum and differ- leads to an oscillator output frequency next iteration the “new values” from
ways have the same frequency, be out signal processing applications. I recall
Z−1
of phase with each other, and may an application patent issued in the
have differing amplitudes. If the out- 1980s that used this oscillator for y2(n)
puts are 90° out of phase, then we generating call progress tones used in
have a quadrature oscillator. Likewise telephony. I found this interesting ▲ 3. Biquad oscillator.
+
+ Σ Z−1 y1(n)
Σ Z−1 y1(n) k −
−
+ k
Σ
+
k
+
Σ Z−1 y2(n)
−
+
Σ Z−1 y2(n)
+
k
− −
Σ Z−1 y2(n) Σ Z−1 y2(n)
k + 1−k2 +
after each iteration? Also, if the er- P0q ▲ Perform one oscillator iteration to
rors are small, the corrections only G= .
P q
(40) update the state variables.
need to be approximate. ▲ Measure the oscillator’s output
Now when we are measuring the power, P.
In this formula, P is the measured
oscillator’s output we will use pow-
power, P0 is the set point power, and ▲ Calculate a gain factor, G.
ers (squares of the amplitude) in-
q is a convergence factor. Since we ▲ And finally, scale the state variables
stead of the amplitudes to avoid
rather not perform division, we will by this gain factor.
square roots. Square root calcula-
use the first-order Taylor’s approxi-
tions tend to be costly in a DSP. The
mation; it has the neat property of
instantaneous power, P, is given by
turning division into subtraction. It is Dynamic
the following formula (in terms of
state variables, matrix elements, and Frequency Control
P
phase shift): G ≈ 1+ q − q . Finally we get to the subject of dy-
P0 (41)
b 2 −b namic frequency control. Since there
x12 − x2 − 2 x1 x 2 cos(φ) are some applications where one
P= c c . Since we are using G to scale the am- would like to have a numerically con-
sin 2 (φ) plitudes (the state variables), it is best
(38) trolled oscillator, we will briefly look
to let q = 1 / 2. Also, when using fixed at what it takes to do this with these
This formula looks painful to imple- point DSPs, it becomes convenient to oscillators. Changing an oscillator’s
ment, but for fixed frequencies, the cal- let the set point power also be 1/2 frequency merely requires modifying
culation only involves six multiplies (amplitude≈0.707). Thus our correc- the rotation matrix’s k value for any
and two subtracts. However, looking tion formula becomes new θ frequency value. The difficult
ahead to being able to change fre- part, however, is maintaining ampli-
3 tude control during dynamic fre-
quency, we see that if we restrict our- G= − P.
selves to the quadrature oscillators 2 (42) quency changes. Since our general
( φ ± 90° ), then the formula for the power formula (38) shows both a de-
power becomes much simpler! It is just But we still have one more poten- pendence on the frequency and am-
tial problem and that is G will nomi- plitude r atio, this can prove
nally be one, and sometimes we will computationally inefficient in the
b 2
P = x12 − x2 . need to multiply the state variables by general case. Thus the problem is up-
c dating the coefficients in the power
(39) a number slightly greater than one. A
trick that can be used is to multiply formula as the frequency is changed.
Along with the power measure- the state variables by 1/2 G and then Plus some oscillators will also change
ment, we need to find the gain needed double the results. So in summary the output amplitudes.
to properly scale the state variables. A AGC approach consists of the follow- If we apply some restrictions to
general gain formula is ing steps per iteration. the type of oscillator we can simplify
k k − 1
Digital waveguide 1 No Yes cos(θ) k + 1 k
1 − k 2 k
Equi-amplitude-staggered update 2 Yes No 2sin(θ/2)
−k 1
k 1 − k2
Quadrature-staggered update 2 No Yes cos(θ)
−1 k
1 − k2 k
Coupled-standard quadrature 4 Yes Yes sin(θ) 2
− k 1 − k
oscillator combination are simply piqued the your interests, and I en- lishing, 1979, pp. 185.
courage you to go and develop your [2] M. Frerking, Digital Signal Processing in Com-
2 own oscillators using the rules and munication Systems. Norwell, MA: Kluwer,
≈ 0707107
. techniques presented here. 1993, pp. 214-217.
2 0 .
0 [3] S. Friedberg and A. Insel, Introduction to Linear
(48) Algebra with Applications. Englewood Cliffs, NJ:
Prentice-Hall, 1986, pp. 253-276.
These are found by scaling the re- Acknowledgment [4] R. Higgins, Digital Signal Processing in VLSI.
sult of (27) by P0 , and P0 is chosen I would like to give credit to those Englewood Cliffs, NJ: Prentice-Hall, 1990, pp.
529-532.
so (42) may be used for amplitude who frequent the USENET group
control. comp.dsp. From time to time ques- [5] S. Leon, Linear Algebra with Applications, 2nd
ed. New York: MacMillan, 1986, pp. 230-259.
For each iteration then, we just tions arise about oscillators, and vari-
▲ Antipodal map, resample, ISI re- ous group participants have offered [6] A. Oppenheim and R. Schafer, Discrete-Time
jection filter, and scale the 1,200 b/s information about oscillators that has Signal Processing. Englewood Cliffs, NJ:
Prentice-Hall, 1989, pp. 342-344.
data to create “k” for this iteration. proved invaluable here for this article.
▲ “Matrix multiply” the state vari- [7] J. Smith and P. Cook, “The second order digital
waveguide oscillator,” in Proc. Int. Computer
ables by the 1,700 Hz fixed frequency Clay Turner is vice president and
Music Conf., San Jose, CA, Oct 1992, pp.
matrix. cofounder of Wireless Systems Engi- 150-153.
▲ “Matrix multiply” the state variables neering, Inc. He has over 20 years of
[8] J. Smith and P. Cook, “System and method for
by the variable frequency matrix; the experience in digital signal process-
real time sinusoidal signal generation using
value of k was determined above. ing, mathematical programming, waveguide resonance oscillators,” U.S. Patent
2 2
▲ Measure the power:*P = x1 + x 2 . embedded programming, telephony, #5701393, Dec 23, 1997.
▲ Calculate the gain: *G = 3 / 2 − P. and the design of “off-air” protocol [9] C. Turner, “A discrete time oscillator for a DSP
▲ Scalar multiply the state variables analyzers, and he is responsible for based radio,” in SouthCon/96 Conf. Rec., Or-
by the gain, G. mathematical algorithm develop- lando, FL, 1996, pp. 60-65.