1
$\begingroup$

Consider the following first order linear system described by:

$\tau \frac{d}{dt}y(t)=-y(t) + x(t)$.

I have seen a discrete time approximation to this system using a "First Order Hold" approximation of the form:

$y[k+1] = e^{-T/\tau} y[k] + [-e^{-T/\tau} + \tau/T(1-e^{-T/\tau})]x[k] + [1 - \tau/T(1-e^{-T/\tau})]x[k+1]$ where $T$ is the sampling period.

Can anyone show a derivation of this result?

$\endgroup$
2
  • $\begingroup$ hmmm. this might be interesting. i can speculate at an answer. $\endgroup$ Dec 10, 2020 at 2:40
  • $\begingroup$ @robertbristow-johnson. Please do! Other discrete-time approximations to continuous linear, time invariant systems (forward/backward difference, impulse invariance, root matching, bilinear transform) are all well-explained in the DSP literature. Haven't seen this one covered in any depth. $\endgroup$
    – rhz
    Dec 10, 2020 at 3:53

1 Answer 1

4
$\begingroup$

The solution comes from assuming that $$ x(t) = x[k] + \frac{x[k+1]-x[k]}{T}(t-kT), \ \ t\in[kT,(k+1)T) $$ where $x[k]:=x(kT)$, this is, a first order hold or a linear interpolation of $x[k]$ and $x[k+1]$ in between $kT$ and $(k+1)T$. Now, we simply compute the EXPLICIT solution of the differential equation (at instants $t=kT$) by integrating it from $t=kT$ towards $t=(k+1)T$. This should be enough to derive the result but let me get into more detail. First, multiply the ODE by $\frac{1}{\tau}e^{t/\tau}$ to obtain: $$ \frac{dy}{dt}e^{t/\tau} + \frac{1}{\tau}e^{t/\tau}y(t) = \frac{1}{\tau}e^{t/\tau}x(t) $$ and notice that $\frac{d}{dt}\left(e^{t/\tau}y(t)\right) = \frac{dy}{dt}e^{t/\tau} + \frac{1}{\tau}e^{t/\tau}y(t)$ and thus: $$ \frac{d}{dt}\left(e^{t/\tau}y(t)\right) = \frac{1}{\tau}e^{t/\tau}x(t) $$ Now integrate both sides: $$ \int_{kT}^{(k+1)T}\frac{d}{dt}\left(e^{t/\tau}y(t)\right)dt = \int_{kT}^{(k+1)T}\frac{1}{\tau}e^{t/\tau}x(t)dt $$ the left hand side results (by fundamental theorem of calculus) into: $$ \int_{kT}^{(k+1)T}\frac{d}{dt}\left(e^{t/\tau}y(t)\right)dt = \left.e^{t/\tau}y(t)\right|_{kT}^{(k+1)T} =e^{(k+1)T/\tau}y[k+1] - e^{kT/\tau}y[k] $$ Thus, $$ e^{(k+1)T/\tau}y[k+1] = e^{kT/\tau}y[k] + \int_{kT}^{(k+1)T}\frac{1}{\tau}e^{t/\tau}x(t)dt $$ Now, simply divide by $e^{(k+1)T/\tau}$ to obtain $$ y[k+1] = e^{-T/\tau}y[k] + e^{-(k+1)T/\tau}\int_{kT}^{(k+1)T}\frac{1}{\tau}e^{t/\tau}x(t)dt $$ As you can see we are almost done. We just have to compute: $$ \begin{aligned} &e^{-(k+1)T/\tau}\int_{kT}^{(k+1)T}\frac{1}{\tau}e^{t/\tau}x(t)dt =\\ &e^{-(k+1)T/\tau}\int_{kT}^{(k+1)T}\frac{1}{\tau}e^{t/\tau}\left(x[k] + \frac{x[k+1]-x[k]}{T}(t-kT)\right)dt \end{aligned} $$ which we can do explicitly since $x[k]$ and $x[k+1]$ are just constants. After some algebra you can factor terms with $x[k]$ and terms with $x[k+1]$ and you will obtain precisely what you wanted. If you want to check, I plugged this into wolfram alpha here ("x1" is $x[k]$ and "x2" is $x[k+1]$).

This kind of discretizations are nice since, if $x(t)$ does behave as a piece-wise linear continuous function, the discretization is NOT an approximation, but an equivalent (and exact) representation of the ODE, this is: since it was obtained by explicit computation of the solution of the ODE, no information is lost about the output samples $y[k]$. (in contrast to approximating $dy/dt \approx (y[k+1]-y[k])/T$ or some other approximation as the bilinear one)

NEW REMARK: I just want to point out that this same procedure can be performed for other high order systems, or even for other types of holders. Recall that any LTI system with scalar input $x$ and scalar output $y$ can be represented by its transfer function, or equivalently by a state space representation $$ \frac{dz}{dt} = Az + Bx,\ \ \ y = Cz $$ with $z(t)\in\mathbb{R}^n$ with $n$ the order of the system, $A$ a square matrix, $B$ a column vector and $C$ a row vector. Recall that the poles of the transfer function are the eigenvalues of $A$ and zeros of the transfer function depend only on the coefficients on contained in $C$. Thus, we can solve for the system on $y[k]$ explicitly using a similar procedure as before: $$ z[k+1] = e^{AT}z[k] + e^{A(k+1)T}\int_{kT}^{(k+1)T}e^{-A\tau}Bx(\tau)d\tau, \ \ y[k]=Cz[k] $$ where $e^{A\tau}$ is the exponential matrix. Finally, plugging in the particular form of $x(t)$ results in the final form of the discretization (in discrete time state space representation). This can be used to derive (exact or "consistent") discretizations for ZOH, FOH, high order holders or more exotic holders.

$\endgroup$
16
  • 1
    $\begingroup$ appears to be a good answer. keep in mind that this FOH is not causal if $x[k]$ is the present moment of time. BTW, there is another model of FOH that is more bizzare. i'm glad you haven't used it. thank you for saving me the effort. all i can do is give you 10 points. $\endgroup$ Dec 11, 2020 at 18:37
  • $\begingroup$ Of course, I agree about the causality issue. However, its the simplest assumption to derive the discretization the OP asked for. Thanks sir! $\endgroup$ Dec 11, 2020 at 18:39
  • 1
    $\begingroup$ there's an article on Wikipedia. the version of FOH you used is the first one shown $\endgroup$ Dec 11, 2020 at 18:43
  • $\begingroup$ Nice remark! What happened is that I noticed the acausality in the original question's discrete system, so this FOH was my first guess. Im glad that it worked on the first try too $\endgroup$ Dec 11, 2020 at 19:04
  • $\begingroup$ @RodrigoAldana Is there a missing factor of 1/tau in the argument to the the exponent in front of the last three integrals? Also, perhaps rusty on ODE's but how does integrating only from kT to (k+1)T solve the ODE? $\endgroup$
    – rhz
    Dec 14, 2020 at 3:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.