Analog circuit design is increasingly encountering mixed-signal circuits, and analog engineers need some understanding of discrete-time sampling circuits, whether they are sample-and-hold circuits or ADCs and DACs. This article series is a mini-tutorial on the discrete complex-frequency domain and its complex variable denoted as z. Only a few decades ago, this was the specialized area of DSP, but now DSP is in the mainstream of what an electronics engineer needs to know. “Mixed-signal” waveforms are discrete in time but continuous (analog) in value.
ADCs and DACs have the same dynamics, only as inverse functions. What applies to one inversely applies to the other. The latch following an ADC performs the hold function and the clock the sampling function. The same is true for a DAC, except that the latch precedes the analog circuitry instead of following it.
Discrete-Time Waveforms and How z Relates to s
Discrete-time intervals are almost always regular intervals of switching period, Ts at switching frequency, fs = 1/Ts. In
μC software, these times are usually interrupt times where the interrupt is driven by a fixed clock, usually a system timer. Each successive iteration of the interrupt code is delayed by Ts. On the nth iteration of the interrupt code, the variables are of the form x(n x Ts) and on the previous iteration through the code were of the form x[(n – 1) x Ts]. Successive cycles of a discrete-time waveform, x(t), can be expressed as x(t) delayed by successive integer multiples, n, of Ts, or as x(t − n x Ts). In the s-domain these delayed cycles in time (meaning that they happen in the future, or to the right on an oscilloscope screen) are Laplace-transformed to become
The second factor appears so often in continuous-frequency expressions of discrete-time circuits that it is defined as
where s is the usual complex frequency,
is the damping and
n is the undamped or resonant frequency, the magnitude of s. Expressed in pole angle, φ, then
= cosφ and
When z is expanded as an s-domain expression, substituting for s,
In polar form, the magnitude of z is related to s by
Because z is a function of a complex number, s, it is also complex. The angle of z, or
, is related to the angle of s as
is related to φ by the scaling factor, 2 x
x (fn/(fs) and varies nonlinearly (sinusoidally) with φ. Real poles and zeros in s (pole angle, φ = 0) are real in z (ϑ
Normalized Transfer Functions and Frequencies - a Digression
Functions in z are often considered to be in the “discrete complex-frequency domain”, but that expression can be misleading. In the s-domain, s is a frequency, in units of s−1 or Hz. Both real (
) and imaginary (
) components of s have the same units. Then transfer functions in s can be expressed in normalized form as
Normalized form makes the transfer function s-dependent factor - the rational function - to have a value of one at s = 0 s–1 for n = 0. T0 is the quasistatic (0+ Hz) gain. With one or more poles at the origin (n
0), the transfer function value at s = 0 s–1 is infinite. The downward-sloping magnitude plot can be moved up or down by the value(s) of p0. Instead of having T0 as the quasistatic gain, an alternative characterization is where the slope of the plot from the origin crosses a gain of one, at p0. Sometimes p0 is lumped in with T0, but then the unity-crossing frequency is lost, a frequency which helps to characterize the Bode magnitude plot.
As an example, the magnitude plot shown below has a pole at the origin which decreases at a slope of −1 on a log-log graph until a zero at z1 bends it to the horizontal. In the mid-frequency range, the gain is a constant Tmid until another zero bends the plot upwards at zero, z2. If the slope of the pole at the origin is projected to the gain-of-one axis (0 dB), it intercepts it at a frequency of
ωp. This is p0 in the normalized transfer function expression, ||xO/xI||.
By expressing transfer functions in normalized form, the units of the poles and zeros and s can be either s−1 or Hz, but must be the same. Usually, s is in units of s−1, but can be in Hz if the zi and pi are also in Hz because the 2 x
factors in 2 x π x f of each cancel when in ratios.
However, the discrete variable, z (not a transfer function zero) is not defined as a frequency as is s. The 1/Ts or fs factor of s in the exponential of z is in Hz and can be expressed in the steady-state as z(j x
The ratio of frequencies, f/(fs/2) occurs frequently in the z-domain. The frequency, fs/2, is the Nyquist frequency. The frequency interval, [0, fs/2) is the Nyquist interval. At and above the Nyquist frequency, waveform aliasing in the time-domain behavior occurs. Within the Nyquist interval, design and analysis of time-domain (or “real-time”) systems usually occurs.
Why z Is Useful
Instead of being a frequency, z consequently is a function of a ratio of frequencies, or frequency normalized to the Nyquist interval. In the time domain, z is a time advance (because the exponential is positive) of Ts. A time delay of one switching cycle is then z−1. This makes transformation from difference equations in time of sampled circuits to the z-domain simple. Computer algorithms in particular are all written as difference equations in time. Values of variables from previous iterations at intervals of Ts are combined in code. Likewise, a control algorithm expressed in z can easily be implemented in interrupt-driven code as difference equations in time. z can be regarded as a time-sequence domain.
For instance, suppose in the
μC some code implements the following equation for a feedback loop compensator:
where a and b are constants. The variable, xo[(n – 1) x Ts] is xo [n x Ts] delayed by one interrupt cycle and in the z-domain converts to z–1 x xo(z). It is xo of the previous iteration; xo is delayed by one iteration time. Before the memory location for xo is updated by the new calculated value, the old value must first be moved to the previous xo memory location.
The above recursion equation converts to
The transfer function in z is thus
This transforms to the s-domain by substituting z = exp(s x Ts) and results not in a continuous (analog) function but in a piecewise-continuous function that in the time-domain is a stair-stepped waveform. However, we began with discrete sample-points in time for a waveform. To go from z to s, a sample-hold function is required, to convert sample points to stair-steps. To investigate this aspect of discrete behavior further, we look further at sample-point sequences in the s-domain.