Back to main page

The discrete derivative and the binomial transform

20 July 2019, 3 PM

I've been thinking about PID control loops recently, and I've realized that they can be thought of as a first order expansion of the error signal into "differ-integral" space. What I mean, loosely, is that given a function f(t) we can take infinitely many derivatives and integrals of f(t) at a point t_0. The set that contains all of these integrals and derivatives is of the same dimension as f(t) (I think). I'm leaving it to a later post (maybe later today) to discuss differ-integral space more (i.e. is it continuous, how much information it encodes, transforms into and out of it, etc.).

Anyways, if we assume that this space exists, then taking the P, I, and D of an error signal can be seen as taking the 0th, 1st, and -1st order terms of the differ-integral expansion. According to this stack exchange post, people tend to use PID controllers because the parameters are physically intuitive and because they're good enough at controlling most physical systems. To quote a good answer from user MdxBhmt:

"Is it all you can do with classical control? Of course not. For example, if you expect a ramp perturbation in your system, the only way for your control reject it with 0 error on steady state is to have a double integrator on your controller.

This is part of a more general rule/principle on classical control - for any signal you want to reject, it has to be part of the controller ( 1/s^2 is a ramp signal, which is also a double integrator transfer function)"

So clearly, in order to get more optimal control it's necessary that we take higher order derivative and integral terms, so the question becomes how to do that in an efficient manner? For simplicity, I started with discrete derivatives (as opposed to fractional) of a discrete signal. Perhaps continuous signals are actually easier, but whatever. Consider the series: $$ s[n] = 0, 1, 4, 9, 25, 36 $$ Clearly this is a discrete version of the continuous signal f(t) = t^2, sampled at t = 1, 2, 3, 4, 5, and 6. We reasonably expect successive derivatives to yield the following series: $$ d_1[n] = 0, 1, 3, 5, 7, 9 $$ $$ d_2[n] = 0, 0, 2, 2, 2, 2 $$ $$ d_3[n] = 0, 0, 0, 0, 0, 0 $$ Where d(i)[n] is the ith derivative of s[n]. Of course, you could compute these successively: $$ d_1[n] = s[n] - s[n-1] $$ $$ d_2[n] = d_1[n] - d_1[n-1] $$ $$ \vdots $$ $$ d_k[n] = d_{k-1}[n] - d_{k-1}[n-1] $$ This is reasonably computationally efficient (I think it's linear in k) but it would be cool if we could express the kth derivative in terms of the original series s[n]. This is actually pretty easy to do (by plugging d1[n] into the expression for d2[n] and so on), and what we find is the following relationship: $$ d_k[n] = \sum_{m=0}^k (-1)^m {k \choose m} s[n-m] $$ I was pretty excited about this relationship, but it turns out it's just as computationally complex as the previous method of computing derivatives (linear in k). That said, it does reveal one cool fact: the discrete derivative is the binomial transform of a shifted s. The binomial transform, in case you haven't seen it before, is defined as: $$ d_k[n] = \sum_{m=0}^k (-1)^m {k \choose m} s[m] $$ Of course, this is kind of intuitive if you think about the binomial transform as a sequence transformation that computes its forward differences (this is actually the first line of the wikipedia page for the binomial transform). The next question that would be interesting to answer, and I'll answer it in my next post, is what is the continuous equivalent of this relationship? Hint: it has to do with fractional calculus!!