# Discretizing a Controller with the Backward Difference Method

In the book "Modern Control Engineering" by Paraskevopoulos it's proved how to discretize a generic controller in the form:

$$G(s)=\frac{Y(s)}{U(s)}=\frac{a}{s+a}$$

where $$a$$ is a constant. Done this, the author says that it is possible to extend this procedure to a general case (without showing how), concluding that in order to discretize a controller $$G(s)$$ i have to simply substitute $$s=\frac{1-z^{-1}}{T}$$ where $$T$$ is the sampling period.

Since the author doesn't show how is possible to extend the procedure to a general controller. Can you explain to me ?

This is kind of hand-wavy, but you can look at this from two different perspectives:

One, you can look at $$z^{-1}$$ as a "back-step" operator; i.e. if $$X(z) = \mathcal{Z}\lbrace x_n \rbrace$$, then (with a few 'i's left undotted and 't's uncrossed) $$\frac{X(z)}{z} = \mathcal{Z}\lbrace x_{n-1} \rbrace$$. You can also look at $$s$$ as a derivative operator: if $$X(s) = \mathcal{Z}\lbrace x(t) \rbrace$$, then $$s X(s) = \mathcal{Z}\lbrace \frac{d}{dt}x(t) \rbrace$$.

And -- the time derivative of $$x(t)$$ is approximately $$\frac{d}{dt}x(t) \simeq \frac{x(t) - x(t - T)}{T}$$. If I throw caution to the wind and just sample the right side, that translates to, again roughly, $$\frac{d}{dt}x(t) \simeq \frac{x_n - x_{n-1}}{T}$$. Now the Laplace of the left and the Z transform of the right gives $$s X \simeq \frac{1 - z^{-1}}{T} X$$. Note that I have left off all pretense of a frequency domain variable on this -- I think that if there's an antithesis of "rigor" it must be "limpor", and we've just found it.

So you can take a system transfer function in $$s$$, expand it into a differential equation, then you can use the approximation $$\frac{d}{dt}x(t) \simeq \frac{x(t) - x(t - T)}{T}$$, then you can take the Z transform, then you turn the resulting difference equation into a transfer function in $$z$$ -- and you have just taken the very long way around to simply substituting $$\frac{1 - z^{-1}}{T}$$ for $$s$$.

The other way you can look at this is to observe that with a continuous-time system, the delay operator has a Laplace-domain transform: $$\mathcal{L}\lbrace x(t - T)\rbrace = e^{-sT} X(s)$$. So you just set $$z^{-1} = e^{-sT}$$. There's ways you can make this more rigorous, but compared to my above treatment this is already granite.

For $$sT \ll 1$$, $$e^{-sT} \simeq 1 - sT$$. Substitute in $$z^{-1} = e^{-sT}$$ and solve for $$s$$ and you get $$s \simeq \frac{1 - z^{-1}}{T}$$. Voila. To get the first forward difference start with $$z = e^{sT} \simeq 1 + sT$$ and you find that $$s \simeq \frac{z - 1}{T}$$. Use $$z = e^{sT} = \frac{e^{\frac{sT}{2}}}{e^{-\frac{sT}{2}}}$$ and you get the Tustin approxmation.

Note, when you actually go to do these, the word approximation. You can generally get by with control systems because you need to sample way faster than the plant dynamics anyway, but -- approximation.

• Why the fact that the laplace transform of the derivative is $sX(s)$ and the zeta trasform of the discrete derivative is $\frac{1}{T}\frac{z-1}{z}X(z)$ tell us that, in order to discretize Laplace we have to substitute $s=\frac{1-z^{-1}}{T}$ ? Moreover, laplace and zeta trasform are different things to me ... And why it holds for every $G(s)$ ? There could be also second and third derivatives... – AleQuercia Nov 20 at 21:03
• It's an approximation. Those properties of the Laplace transform and the z transform tell us that we can approximate differentiation by substituting $s = (1 - z^{-1})/T$. – TimWescott Nov 20 at 21:15
• If you treat the sampling process as a multiplication by a train of unit impulses, then the result is that the sampled-time signal equals $\sum_{n=0}^\infty \delta(t - nT) x(nT)$. Take the Laplace transform of that and it equals the z transform with $z = e^{sT}$. This should be in the first or second chapter of any signal processing book that deals with discrete-time signals. – TimWescott Nov 20 at 21:17
• I couldn't give you a super-rigorous mathematical proof of why It holds for every $G(s)$, but loosely speaking it holds because you can take $G(s)$ apart into a differential equation, then use the time-domain approximation for differentiation, then sample, then take the z transform. – TimWescott Nov 20 at 21:19