DSPRelated.com
Forums

The z-plane's unit circle

Started by Rick Lyons December 13, 2012
On Thu, 13 Dec 2012 11:35:59 -0800, clay wrote:

> On Thursday, December 13, 2012 2:30:40 PM UTC-5, Robert Adams wrote: >> I have used these on dsps with no sin table. They work great except if >> you change the frequency on the fly, the amplitude may change. Depends >> on when the coefficients change relative to the sine wave. >> >> >> >> >> >> Bob > > It is easy to add amplitude stabilization to a digital resonator to > solve that problem.
You'd still get a bump in the amplitude. Hmm. Is it possible to make a state-space (or otherwise) digital oscillator that lets you change frequency on the fly without having an amplitude bump? Now there's an interesting question... -- My liberal friends think I'm a conservative kook. My conservative friends think I'm a liberal kook. Why am I not happy that they have found common ground? Tim Wescott, Communications, Control, Circuits & Software http://www.wescottdesign.com
Robert

One reason you may wish to use an infinite-Q resonator as an oscillator is that you can make a pll out of the oscillator and then use the frequency control variable to operate some filters that have the same structure as the oscillator only with finite Q.  


Bob
On 12/13/12 2:55 PM, Tim Wescott wrote:
> On Thu, 13 Dec 2012 11:35:59 -0800, clay wrote: > >> On Thursday, December 13, 2012 2:30:40 PM UTC-5, Robert Adams wrote: >>> I have used these on dsps with no sin table. They work great except if >>> you change the frequency on the fly, the amplitude may change. Depends >>> on when the coefficients change relative to the sine wave. >>> >>> >>> >>> >>> >>> Bob >> >> It is easy to add amplitude stabilization to a digital resonator to >> solve that problem. > > You'd still get a bump in the amplitude. > > Hmm. Is it possible to make a state-space (or otherwise) digital > oscillator that lets you change frequency on the fly without having an > amplitude bump? Now there's an interesting question...
quadrature oscillator won't have a bump. at least not theoretically. but it still needs a little AGC (and i remember Jerry suggesting the perfect AGC for it years ago) because numerically, if you miss the cos(omega) and sin(omega) coefficients (do to rounding) the amplitude will either die slowly or grow slowly because cos^2 + sin^2 won't exactly add to 1. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
Robert 

Maybe we are thinking about different structures. If you put one delayed integrator and one non-delayed integrator in a feedback loop, and both integrators have a gain of sqrt(2-2*cos(feta)) then the quantization only effects the pole angle, not the radius. Hit it with an impulse and it rings at constant amplitude forever. Unless you change the frequency on the fly .....

You can of course add an amplitude control loop by feeding back to the middle node. If you are clever you realize that since the two integrators have quadrature signals, you can take the sum of squares as the amplitude control which has no ripple.  

Bo 

Bob
Correction, the quadrature relationship only holds for the analog version of this oscillator; for the digital version it's "almost" true but at higher frequencies it becomes less true. 

Bob
robert bristow-johnson <rbj@audioimagination.com> wrote:
> On 12/13/12 2:16 PM, Thomas Heller wrote: >> Am 13.12.2012 12:00, schrieb Rick Lyons:
>>> I've been thinking about digital oscillators >>> with regard to their implementation in >>> fixed-point systems.
>> What is the advantage of a digital oscillator against, >> say, a DDS generator?
> *what* is the difference?
> i still haven't understood anyone who differentiates the concepts of > "Direct Digital Synthesis" (whatever that means) and the good ol' > "Numerically Controlled Oscillator" with the phase accumulator and such.
Hmm, I usually think of DDS as being (analog) PLL based. That is, phase locked to a nice ratio of the reference. Now that I think about it, having an analog PLL in something with "direct" and "digital" in the name seems funny, but that is what I always thought it was. The phase accumulator doesn't have the PLL in it. -- glen
glen herrmannsfeldt <gah@ugcs.caltech.edu> writes:

> robert bristow-johnson <rbj@audioimagination.com> wrote: >> On 12/13/12 2:16 PM, Thomas Heller wrote: >>> Am 13.12.2012 12:00, schrieb Rick Lyons: > >>>> I've been thinking about digital oscillators >>>> with regard to their implementation in >>>> fixed-point systems. > >>> What is the advantage of a digital oscillator against, >>> say, a DDS generator? > >> *what* is the difference? > >> i still haven't understood anyone who differentiates the concepts of >> "Direct Digital Synthesis" (whatever that means) and the good ol' >> "Numerically Controlled Oscillator" with the phase accumulator and such. > > Hmm, I usually think of DDS as being (analog) PLL based. That is, > phase locked to a nice ratio of the reference.
I thought that was called a "frequency synthesizer." -- Randy Yates Digital Signal Labs http://www.digitalsignallabs.com
On 13 Dec., 20:41, robert bristow-johnson <r...@audioimagination.com>
wrote:
> On 12/13/12 2:16 PM, Thomas Heller wrote: > > > Am 13.12.2012 12:00, schrieb Rick Lyons: > > >> I've been thinking about digital oscillators > >> with regard to their implementation in > >> fixed-point systems. > > > What is the advantage of a digital oscillator against, say, > > a DDS generator? > > *what* is the difference? > > i still haven't understood anyone who differentiates the concepts of > "Direct Digital Synthesis" (whatever that means) and the good ol' > "Numerically Controlled Oscillator" with the phase accumulator and such. > > i realize that, for different waveforms, that there are different ways > of doing things, like for a simple square wave, you can have a simple > count-down timer and toggle the output, or for a pure sine, you can > synthesize it from an equation (or equations) similar to > > &#4294967295; &#4294967295; y[n] &#4294967295;= &#4294967295;2 cos(omega) y[n-1] &#4294967295;- &#4294967295;y[n-2] > > &#4294967295; &#4294967295; (there's another pair of equations for quadrature synthesis) > > and with the typical NCO, it's a phase accumulator with table lookup > and, perhaps, some interpolation. > > does not DDS include any of these methods? > > Rick (and group), isn't this largely a solved problem? >
I've don't think I've ever seen DDS used about anything but a phase accumulator and a lookup table -Lasse
On Thu, 13 Dec 2012 13:13:41 -0800, Robert Adams wrote:

> Correction, the quadrature relationship only holds for the analog > version of this oscillator; for the digital version it's "almost" true > but at higher frequencies it becomes less true. > > Bob
If you formulate the oscillator such that [ cos(w) sin(w) ] x_n = [ ] * x_{n-1} [-sin(w) cos(w) ] then the two elements of x will always be in quadrature, regardless of the frequency. The value w is equal to omega_osc * T_s, or 2 * pi * f_osc * T_s, where T_s is the sampling rate. This is the "state-space" oscillator that I alluded to, and (I suspect) at least mathematically equivalent to the quadrature oscillator that RBJ was talking about, too. It does require more multiplies, but because of the way it distributes the errors, it requires half the precision of a direct-form oscillator. It'll still need some sort of AGC, with the oscillator damping controlled by increasing or decreasing the value that you take to be "sin(w)". -- My liberal friends think I'm a conservative kook. My conservative friends think I'm a liberal kook. Why am I not happy that they have found common ground? Tim Wescott, Communications, Control, Circuits & Software http://www.wescottdesign.com
On 12/13/12 3:54 PM, Robert Adams wrote:
> > Maybe we are thinking about different structures. If you put one delayed integrator and one non-delayed integrator in a feedback loop, and both integrators have a gain of sqrt(2-2*cos(feta)) then the quantization only effects the pole angle, not the radius. Hit it with an impulse and it rings at constant amplitude forever. Unless you change the frequency on the fly ..... >
i'm thinking of two structures. both have two states (and i think that any resonant oscillator needs two states). the common one with a single output: x[n] = 2 cos(omega) x[n-1] - x[n-2] and with initial states x[-2] = A cos(phi - 2 omega) x[-1] = A cos(phi - omega) will oscillate with amplitude A and normalized frequency omega and initial phase of phi. because the coefficient on x[n-2] is 1, it should be a pretty stable amplitude if the rounding is to nearest and you have a decent number of bits, even without AGC. the two initial states fully determine the amplitude and phase, so when omega is suddenly changed, you have to consider x[n-1] and x[n-2], along with your *new* omega as initial states for a new stretch of oscillation. i s'pose i could work out the math, but i'm too lazy to. you get a new A and a new phi (extrapolating back to a hypothetical x[0]). it's certain that the amplitude will change. to prevent that, you need to readjust x[n-2] assuming that x[n-1] is precisely the sample you would want with the new omega (having the same phase and amplitude). the quadrature resonant oscillator i was thinking of is x[n] = cos(omega) x[n-1] - sin(omega) y[n-1] y[n] = sin(omega) x[n-1] + cos(omega) y[n-1] with initial states x[-1] = A cos(phi - omega) y[-1] = A sin(phi - omega) if there were no numerical issues, the coefficients cos(omega) and sin(omega) would always square and add to 1. and the two states would always be the cos() and sin() of the same angle and they would also square and add to A^2. but we know if, do to rounding, if the coefficients square and add to less than 1, then x[n] and y[n] will together spiral slowly down toward zero. and if the coefs square and add to more than 1, then the spiral will increase at the same dB-per-sample rate. so, if A is specified, these coefs might need to be minutely adjusted (maybe just the LSB) to keep the amplitude of the quadrature pair at A. or, maybe make sure that the coefs are rounded *up* so that they square and add to something slightly bigger than 1 and apply limiting to x[n] and y[n] to amplitude A (that was my cheapie solution with a DSP that has saturation arithmetic).
> You can of course add an amplitude control loop by feeding back to the middle node. If you are clever you realize that since the two integrators have quadrature signals,
i am not clever enough. i am not sure what the structure is you mean.
> you can take the sum of squares as the amplitude control which has no ripple.
just so that i know what you're saying, can you toss up a difference equation that defines exactly what the output is as a function of the two states?
> Bo
you be the prez? (dunno if you saw those tweets from "-bo".) -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."