Conversion of Differential Equation to Difference Equation - Zero Order Hold

Off late I have been posting a lot of problems based on the general dynamic system of the form:

x˙=x+u\dot{x} = x + u

Here, x=x(t)x=x(t) represents a time-dependent quantity of the system whereas u=u(t)u = u(t) is a time-varying input meant to excite the system. The behaviour of this system is captured using the differential equation described above. This note describes how to convert a differential equation to a discrete-time difference equation.

Consider the differential equation:

x˙x=u\dot{x} - x = u Multiplying both sides by ete^{-t} gives: etx˙etx=etu e^{-t}\dot{x} - e^{-t}x = e^{-t}u

This can be simplified to:

ddt(etx)=etu\frac{d}{dt}\left(e^{-t}x\right) = e^{-t}u

Or:

d(etx)=uetdtd\left(e^{-t}x\right) = ue^{-t} dt

Given that the initial condition of the system is x(0)=xox(0) = x_o, integrating both sides:

xoxetd(etx)=0tu(s)esds\int_{x_o}^{xe^{-t}} d\left(e^{-t}x\right) = \int_{0}^{t} u(s)e^{-s} ds

Which is:

xetxo=0tu(s)esdsxe^{-t} - x_o = \int_{0}^{t} u(s)e^{-s} ds

Implies:

x(t)=xoet+et0tu(s)esdsx(t) = x_oe^{t} + e^{t}\int_{0}^{t} u(s)e^{-s} ds

Consider a general time t1=Tt_1 = T and another time instant t2=T+ht_2 = T + h, where hh represents a small time step.

x(T)=xoeT+eT0Tu(s)esdsx(T) = x_oe^{T} + e^{T}\int_{0}^{T} u(s)e^{-s} ds x(T+h)=xoe(T+h)+e(T+h)0T+hu(s)esdsx(T+h) = x_oe^{(T+h)} + e^{(T+h)}\int_{0}^{T+h} u(s)e^{-s} ds

Which can be written as: x(T+h)=xoe(T+h)+e(T+h)0Tu(s)esds+e(T+h)TT+hu(s)esdsx(T+h) = x_oe^{(T+h)} + e^{(T+h)}\int_{0}^{T} u(s)e^{-s} ds + e^{(T+h)}\int_{T}^{T+h} u(s)e^{-s} ds

Or, x(T+h)=eh(xoe(T)+e(T)0Tu(s)esds)+e(T+h)TT+hu(s)esdsx(T+h) = e^h\left(x_oe^{(T)} + e^{(T)}\int_{0}^{T} u(s)e^{-s} ds\right) + e^{(T+h)}\int_{T}^{T+h} u(s)e^{-s} ds

Recognising that the term in the bracket multiplied by ehe^h is x(T)x(T) gives:

x(T+h)=ehx(T)+TT+hu(s)e(T+hs)dsx(T+h) = e^hx(T) + \int_{T}^{T+h} u(s)e^{(T+h-s)} ds

Addressing the remaining integral: Taking T+hs=zT+h-s = z, plugging into the integral, manipulating and simplifying gives:

x(T+h)=ehx(T)+0hu(T+hz)ezdzx(T+h) = e^hx(T) + \int_{0}^{h} u(T+h-z)e^z dz

The only assumption made in this entire analysis is that x(T)x(T) and u(T)u(T) are held constant in the interval [T,T+h)[T,T+h) . In other words, u(T+hz)=u(T)u(T+h-z) = u(T) as zz varies from 00 to hh. This leads to:

x(T+h)=ehx(T)+(0hezdz)u(T)x(T+h) = e^hx(T) + \left(\int_{0}^{h} e^z dz\right) u(T)

In other words:

x(T+h)=ax(T)+bu(T)x(T+h) = a x(T) + b u(T)

Where: a=eha = e^h and b=0hezdzb = \int_{0}^{h} e^z dz

So, in summary, this analysis shows the conversion of a differential equation to a discrete-time difference equation.

x˙=x+u\dot{x} = x + u

Is equivalent to, in discrete time:

x(T+h)=ax(T)+bu(T)\boxed{x(T+h) = a x(T) + b u(T)}

Where: a=eh\boxed{a = e^h} and b=0hezdz\boxed{b = \int_{0}^{h} e^z dz}

Now, an example is presented to illustrate this process:

Consider the equation:

x˙=x+u\dot{x} = x + u

Here, x(0)=0x(0) = 0 and u(t)=1u(t) = 1 is a constant input. This differential equation is converted to a discrete difference equation and both systems are simulated. The plots show the response of this system for various time steps hh. In the first plot, h=0.1h = 0.1 s. In the second plot, h=0.05h = 0.05 s. In the third plot, h=0.01h = 0.01 s. In the fourth plot, h=0.001h = 0.001 s.

So one can see that hh reduces, the discrete-time response comes closer to that of the continuous-time response.

The results derived for a specific dynamic system in this note can be generalized for any linear dynamic system in any number of dimensions. An interested reader may attempt to do so and post his/her comments on this subject.

Note by Karan Chatrath
3 weeks, 6 days ago

No vote yet
1 vote

</code>...<code></code> ... <code>.">   Easy Math Editor

MarkdownAppears as
*italics* or _italics_ italics
**bold** or __bold__ bold

- bulleted
- list

  • bulleted
  • list

1. numbered
2. list

  1. numbered
  2. list
Note: you must add a full line of space before and after lists for them to show up correctly
paragraph 1

paragraph 2

paragraph 1

paragraph 2

[example link](https://brilliant.org)example link
> This is a quote
This is a quote
    # I indented these lines
    # 4 spaces, and now they show
    # up as a code block.

    print "hello world"
# I indented these lines
# 4 spaces, and now they show
# up as a code block.

print "hello world"
MathAppears as
Remember to wrap math in </span>...<span></span> ... <span> or </span>...<span></span> ... <span> to ensure proper formatting.
2 \times 3 2×3 2 \times 3
2^{34} 234 2^{34}
a_{i-1} ai1 a_{i-1}
\frac{2}{3} 23 \frac{2}{3}
\sqrt{2} 2 \sqrt{2}
\sum_{i=1}^3 i=13 \sum_{i=1}^3
\sin \theta sinθ \sin \theta
\boxed{123} 123 \boxed{123}

Comments

Sort by:

Top Newest

It's interesting that you introduced exponentials into this. My basic intuition would have been:

x˙=x+ux(T+h)=x(T)+hx˙(T)x(T+h)=x(T)+h(x(T)+u(T))x(T+h)=x(T)(1+h)+hu(T) \dot{x} = x + u \\ x(T+h) = x(T) + h \dot{x} (T) \\ x(T+h) = x(T) + h \Big( x(T) + u(T) \Big) \\ x(T+h) = x(T) (1 + h) + h u(T)

Of course, as we know from numerical integration in general, there are a variety of ways to do the computations. With a sufficiently small step-size, they should all basically agree.

Steven Chase - 3 weeks, 6 days ago

Log in to reply

Hello! It is true that approximating the derivative is a more straightforward approach to discretization. You rightly pointed out that there exist many approaches to go about this operation and that with a sufficiently small step size, the response would be indistinguishable with the continuous-time response.

A good way to compare these methods is by doing so in the frequency domain. Certain methods lead to a discrete system which approximates the frequency response better than other discretization methods.

The method described in this note is in fact, not the best approach when one considers frequency domain responses. It is an interesting approach though.

Karan Chatrath - 3 weeks, 6 days ago

Log in to reply

I was thinking about that. This reminds me of the 2-tap vs 3-tap differentiator exercise. Would you like to post a problem comparing the frequency response of your method vs. the Euler-style approach?

Steven Chase - 3 weeks, 6 days ago

Log in to reply

@Steven Chase Thanks for the suggestion. I will think of a problem and post it.

Karan Chatrath - 3 weeks, 6 days ago

Log in to reply

@Steven Chase I have posted a problem in the calculus section. I feel that it is worded in a slightly convoluted manner but I've tried my best to be clear. Please give suggestions if necessary.

Karan Chatrath - 3 weeks, 5 days ago

Log in to reply

@Karan Chatrath That was a nice problem. Thanks for posting it. I will post a solution a bit later today when I have some more time.

Steven Chase - 3 weeks, 5 days ago

Log in to reply

×

Problem Loading...

Note Loading...

Set Loading...