# Zero-order hold discretization?

I have some difficulties understanding something. There are several discretization methods, such as zero-order-hold (ZOH), forward euler, backward euler, tustin, et cetera.

1. Forward euler, backward euler, et cetera discretization methods approximate the computation of a integral (see below), but what is the integral approximation when using a ZOH? What does a ZOH do?
2. Why does Matlab not support forward euler, backward euler, Simpsons rule or even higher order integral approximations as discretization methods? But only ZOH, tustin, zero-pole matching? Is there a reason for it?
3. Is it even usefull to use for instance Simpsons rule as a discretization method or even use higher order approximations? As far as I read, from http://en.wikibooks.org/wiki/Control_Systems/Z_Transform_Mappings#Simpson.27s_Rule, Simpsons rule has only one disadvantage?

For instance,

Consider the transfer function

$$\frac{F(s)}{E(s)} = \frac{1}{s}$$

This corresponds to the differential equation

$$\frac{\mathrm{d}f(t)}{\mathrm{d}t} = e(t)$$

Integrating both sides gives

$$f(t) = f(t_0) + \int_{t_0}^{t} e(t) \mathrm{d}t$$

Now t is evenly spaced, e.g., t = kT, with k = 0,1,2,... During one sampling t0 = kT and t = kT + T, the solution becomes

$$f(kT + T) = f(kT) + \int_{kT}^{kT + T} e(t) \mathrm{d}t$$

Now using the trapeziodal rule (tustin) http://en.wikipedia.org/wiki/Trapezoidal_rule. The integral is approximated by

$$\int_{a}^{b} f(x)\, dx \approx (b-a) \left[\frac{f(a) + f(b)}{2} \right]$$

As a result, we obtain

$$f(kT + T) = f(kT) + \frac{kT + T - kT}{2} \left( e(kT) + e(kT + T) \right)$$

Using the z-transform you get

$$(z - 1)F(z) = \frac{T}{2} (z + 1) E(z) \rightarrow \frac{F(z)}{E(z)} = \frac{T}{2} \frac{z + 1}{z - 1}$$

and as such you determine by comparing the result with the very first equation that

$$s = \frac{2}{T} \frac{z - 1}{z + 1}$$

The same you can determine using forward euler, backward euler, et cetera. Now I am wondering what is the replacement for the laplace variable s when you will be using ZOH? And what kind of approximation does the ZOH use? As far as I understand you discretize the system using ZOH by applying

$$G(z) = (1 - z^{-1}) \mathcal{Z}\left\{\frac{G(s)}{s}\right\}$$

In a hybrid system, the sampler and ZOH perform the operations: a continuous signal is sampled (analogue to digital conversion, ADC) to produce a discrete signal, and the discrete signal is returned to continuous form (digital-to-analogue conversion, DAC). Usually there is some digital processing between these two operations, but the combined DAC/ADC operation is normally represented as a single Laplace TF in the block diagram.

For simplicity, consider the ZOH in isolation, i.e. no data processing between the sample and hold. Let the input signal = x(t), the output signal = y(t), and the sampling increment = T sec. At the k'th sampling instant (ie at t=kT), the input to the ADC may be denoted x(k) and the output from the DAC is held constant at x(k) until the next sample arrives.

Thus, the DAC output between x(k) and x(k+1) is a rectangular pulse of height, x(k), and duration, T. This can be modelled, for Laplace transform representation, as a step of height x(k) at t=kT and a step of height -x(k) at time t=(k+1)T, and may be realised via the LT delay operator, e^-skT, which delays any signal by kT sec

Hence the LT of the isolated pulse is {e^(-skT)} x(k)/s - {e^[-s(k+1)T} x(k)/s, or:

e^(-skT) {1-e^-sT} x(k)/s

For the entire signal, from t=0 to t=kT this function reduces to Y(s) = X(s) {1-e^-sT}/s where X(s) and Y(s) are the Laplace transformed ZOH input and output. Hence Y(s)/X(s) = (1-e^-sT)/s

If, now, we wish to proceed by connecting a G(s) block to the ZOH output, the overall TF becomes (1 - e^-sT) G(s)/s. But there's a problem: if we are required to close the loop around this TF, the resultant CLTF will not be analytic due to e^-sT appearing in the CLTF denominator. So we must revert to z-transforms to render it analytic.

The z-transform of the exponential bit is easy; it's (1 - z^-1), because z^-1 is the delay operator in the z-domain (and is therefore equivalent to e^-sT) and we must then find the z-transform of G(s)/s to complete the picture.

• this answer is not correct. the ZOH is not part of the ADC operation at all (whether there is a S/H there or not). the ZOH is part of a conventional DAC that holds the output at a constant voltage in between discrete sample instances. – robert bristow-johnson Dec 16 '15 at 19:19
• @Robert bristow-Johnson; the ZOH is the combined sample+hold function, where 'sample' is the ADC, converting a sample to a binary number every T sec, and 'hold' is the DAC - reconstructing a continuous signal. Usually there is a discrete system (difference equation) between these two operations. – Chu Dec 16 '15 at 23:43
• you do not understand this. It doesn't make any difference to the discrete-time data $x[n]$ whether the analog signal at time $nT$ was held to the value of $x(nT)$ or not. if $x(t)$ goes into the sampler and $x[n] \triangleq x(nT)$ comes out of the sampler into the DSP or whatever processor, the presence or absence of the S/H is immaterial to the data values. it's the same as an ideal sampler with dirac impulses. but on the other end, if it is not dirac impulses coming out of the DAC and peicewise-constant pulses instead, a model (the ZOH) is needed to convert it. – robert bristow-johnson Dec 17 '15 at 0:02
• @robert Bristow-Johnson, Yes, I know what sampled data is, and I know how to reconstruct a continuous time signal from a discrete sequence using a zoh. What's your point? – Chu Dec 17 '15 at 1:30
• my point is that your answer is wrong. there are not two ZOHs as your answer says. if your hybrid system was modeled with a ZOH preceding the A/D and another ZOH after the D/A, the total frequency response would be incorrect because it would have two ZOHs in it, instead of the correct number. i have started a question for us, as a Stack Exchange group, to get to the bottom of this. and we will. – robert bristow-johnson Dec 17 '15 at 1:36

To adress the 3 specific questions: 1. A zero-order hold element is used to take a discrete signal at time kT and holds the value constant (0-order, remember?) until time kT+T. See Wikipedia(in the comments).

1. Matlab does, what they want.

2. Sampling is damn fast these days. Zero order hold is basically the easiest thing you can do, and if you sample a lot faster, than the relevant dynamics are, you are good to go! Tustin does, what you described: trying to interpolate the integral by that of a linear function.

There are certain benefits of either method. Clearly higher orders would be nice. However, they come at computation cost and complexity. Some methods preserve the pole positions of the system (making the dynamics closely related), while others distort them pretty much. Generally speaking, higher order is not allways the way to go for. Lets say you sample a mars rocket with 1ms and apply a 4th order integral approximation. If you have maybe a degree change in 10 seconds, that makes 10000 samples to find out and react. No need to get higher order things in between.

As allways order depends on your application. In this case higher than linear is not really a benefit. I think you'd rather increase the sampling rate instead.

Specifically to the example: Chu's answer is correct, however for me it was stopping exactly, where I wanted to know more: at $$G(z) = (1-z^{-1}) \; \mathcal{Z} \left\{ \frac{G(s)}{s} \right\}$$ and exactly how is $G\big(s=F(z)\big)$ obtained.

Deviating from the notation of the OP, let y be the output of an integrator, and x it's input. In the frequency domain (Laplace Transform) this is: G(s) = 1/s. Let $T_s$ be the sampling time. For the integrator in the time domain we have:

$$y(kT+T) = y(kT) + \int_{kT_s}^{kT_s+T_s} x(\tau) d\tau$$ now just as in the OP's example we try to approximate this integrator by approximating $$\frac{\hat{y}(z)}{\hat{x}(z)}$$. Since we do so by holding the value constant (zero order hold) which was applied at time kT, we get $$y(kT+T) \approx y(kT) + x(kT) T_s$$. Applying the z transform this is equivalent to $$z \hat{y}(z) = \hat{y}(z) + \hat{x}(z) T_s$$. By reordering, we get $$\frac{\hat{y}(z)}{\hat{x}(z)} = \frac{T_s}{z-1}$$ and by remembering, that we modeled an integrator, which is $$\frac{Y(s)}{X(s)} = \frac{1}{s}$$ we end up with: $$s \leftarrow \frac{z-1}{T_s}$$ and can now write $$F(z) = \frac{z-1}{T_s}$$.

• i haven't seen this question before. it seems that the question and answers are conflating a couple of different topics. i would direct people to the Wikipedia article about Zero-order hold. not all wikipedia articles are technically accurate, but this one is. A zero-order hold is the model of what a typical DAC does converting discrete-time samples (whose value has no meaning in between the discrete samples) into a continuous-time waveform that is a piecewise-constant function. – robert bristow-johnson Dec 16 '15 at 19:14
• @Robert Bristow-Johnson; Take a simple example, let $G(s)=\dfrac{1}{s}$. This leads to: $G^*(z) = (1-z^{-1}) \; \large \mathcal{Z}\small \left\{ \dfrac{G(s)}{s} \right\}=\dfrac{z-1}{z} \; \large \mathcal{Z}\small \left\{ \dfrac{1}{s^2} \right\}=\dfrac{z-1}{z}\dfrac{Tz}{(z-1)^2}=\dfrac{T}{z-1}$ – Chu Dec 16 '15 at 23:58
• that example doesn't mean anything until you define what $G(\cdot)$ is supposed to be and what $G^*(\cdot)$ is supposed to be. and you apparently haven't examined the main point i wrote. – robert bristow-johnson Dec 17 '15 at 0:07
• and i sure as heck do not understand what the Z-transform of a function with $s$ is. – robert bristow-johnson Dec 17 '15 at 0:17
• F(z) is the z-transform of the sampled sequence, f(kT), where f(t) is the inverse laplace transform of F(s). Clearly, there is loss of information in the sampling operation. – Chu Dec 17 '15 at 1:23