Discretization of Continuous-Time State Equation

8.4 Discretization of Continuous-Time State Equation

In Chap. 6, we studied various discretzation methods that can be used for converting

a given s -transfer function or a differential equation into an ‘equivalent’ z -transfer function or a difference equation. In this section, we will develop a technique to discretize a continuous-time state equation into an ‘equivalent’ discrete-time state equation.

8.4.1 State Equation Without Time Delay

Let us consider a continuous-time state equation

x ′ (t ) = Ax(t) + Bu(t)

(8.4.2) As shown in Sect. 8.2.2, the solution to these equations is given by Eq. (8.2.8a):

y (t ) = Cx(t) + Du(t)

x(t) = φ(t − t 0 )x(t 0 )+

φ (t − τ )Bu(τ )dτ (8.4.3)

To obtain an ‘equivalent’ discrete-time state equation, we write the state transition equation for an interval of sampling period T from t 0 = nT to t = (n + 1)T :

(n+1)T

x((n + 1)T ) = φ(T )x(nT ) + φ (nT + T − τ )Bu(τ )dτ (8.4.4)

nT

Assuming that the input is constant during each sampling interval, i.e., u(t ) = u (nT ) = u[n] for nT ≤ t < (n + 1)T , we can rewrite this equation as

8.4 Discretization of Continuous-Time State Equation 371

(n+1)T

x[n + 1] = φ(T )x[n] + φ (nT + T − τ )dτ Bu[n]

nT

x[n + 1] = A D x[n] + B D u [n]

where we have let x(nT ) = x[n], u(nT ) = u[n], and

A D = φ(T ) = e AT

(8.4.6a)

(n+1)T 0 nT +T −τ →σ T

We can get the discrete-time system matrices A D and B D by substituting the state transition matrix (8.2.2a) into these Eqs. (8.4.6a) and (8.4.6b), which is cumbersome in general. As an alternative, it may be better to use a digital computer for evaluating them in the following way [F-1]:

(8.4.6a) ∞

=e =

A D AT (D.25)

= I + AT = I + AT Ψ m (8.4.7a) !

≃I+ 2 I+ 3 I+··· I+

N−1 N ···

m=0

(8.4.8) Here, the infinite number of summations in Eq. (8.4.8) is truncated to some finite number N , which will be chosen in consideration of the desired accuracy and computation time.

Example 8.3 Discretization of a Continuous-Time State Equation

Consider a continuous-time LTI system described by Eqs. (E8.1.2) and (E8.1.3) in Example 8.1(a), where the state transition matrix is given by Eq. (E8.1.5) as

for t ≥ 0 (E8.3.1)

372 8 State Space Analysis of LTI Systems (a) Find the discretized state equation.

We can use Eqs. (8.4.6a) and (8.4.6b) to get

(8.4.6b) T

so that the discretized state equation can be obtained as

u [n] (E8.3.4)

%sig08e03.m clear, clf syms s z Ns=1; Ds=[1 1 0]; Gs=tf(Ns,Ds); % Analog transfer function [A,B,C,D]=tf2ss(Ns,Ds) % Transfer function to state equation N=size(A,2); % the dimension of the system % The numerator/denominator of transfer function (8.3.2a) [Ns,Ds]=ss2tf(A,B,C,D) Gs1= C*(s*eye(N)-A)ˆ-1*B + D; pretty(Gs1) % Eq.(8.3.2a) T=0.1; NT=101; t=[0:NT-1]*T; % To find the response to step input applied to the 1st input terminal [y,x,tt]=step(A,B,C,D,1,t); syms s t %for symbolic solution of the state eq. A=[0 1;0 -1]; B=[0 1]’; % Eq.(E8.1.2) x0=[0 0]’; % zero initial condition % Laplace transform solution Xs=(s*eye(N)-A)ˆ-1*(x0+B/s) % Eq.(8.2.3a) % Inverse Laplace transform for n=1:N, xt(n)=ilaplace(Xs(n)), end for n=1:length(tt)

t=tt(n); y1(n)=eval(xt(1)); % Eq.(E8.1.3) with C=[1 0] end % To solve the differential equation directly x=dsolve(’Dx1=x2,Dx2=-x2+1’,’x1(0)=0,x2(0)=0’); % Eq.(E8.1.2) t=tt; y2= eval(x.x1); % Eq.(E8.1.3) with C=[1 0] plot(tt,y,’k’, tt,y1,’b’, tt,y2,’r’) % Discretization A=[0 1;0 -1]; B=[0 1]’; C=[1 0]; D=0; % Eq.(E8.1.2) [Ad,Bd,Cd,Dd]=c2dm(A,B,C,D,T,’zoh’) % Discretized state equation [Ad1,Bd1]=c2d steq(A,B,T) % Eq.(8.4.7a,b)

e T=exp(-T); Ad2=[1 1-e T; 0 e T], Bd2=[T+e T-1; 1-e T] % Eq.(E8.3.4) % The numerator/denominator of transfer function (8.3.2b) [Nz,Dz]=ss2tf(Ad,Bd,Cd,Dd) % Eq.(8.3.2b) to (E8.2.3) or (E8.3.5) Nz1=[T-1+e T 1-e T-T*e T], Dz1=[1 -1-e T e T] %Gz1= Cd*(z*eye(N)-Ad)ˆ-1*Bd + Dd, pretty(Gz1) % The z.o.h. equivalent of the analog transfer function

8.4 Discretization of Continuous-Time State Equation 373

Gz zoh=c2d(Gs,T,’zoh’); [Bd zoh,Ad zoh]=tfdata(Gz zoh,’v’) % Eq.(E8.3.7) % To find the response to step input applied to the 1st input terminal yd=dstep(Ad,Bd,Cd,Dd,1,NT); hold on, stairs(tt,yd)

function [Ad,Bd]=c2d steq(A,B,T,N) if nargin<4, N=100; end I= eye(size(A,2));

PSI= I;

for m=N:-1:1, PSI= I +A*PSI*T/(m+1); end % Eq.(8.4.8) Ad= I +A*T*PSI; Bd= PSI*T*B; % Eq.(8.4.7a,b)

Note that this is identical to Eq. (E8.1.7) in Example 8.1(b) and the trans- fer function of the system was computed via Eq. (8.3.2b) as Eq. (E8.2.3) in Example 8.2:

G D (T − 1 + e −T )z + 1 − e −T −Te [z] = −T (E8.3.5)

(z − 1)(z − e −T )

(b) Find the transfer function for the z.o.h. (step-invariant) equivalent of the continuous- time system. Noting from Eq. (E8.2.1) that the transfer function of the continuous-time system is

we can use Eq. (6.2.5) to get

G (6.2.5) st ep [z] = (1 − z −1 ) Z L −1

G (s)

t =nT

(E8.3.6) z−1

s 2 (s + 1) + s + s+1 B.8(3),(4)&(6) z−1

= (z − 1)(z − e −T

(E8.3.7)

This is the same as the transfer function of the system described by the dis- cretized state equation (E8.3.4) and output equation (E8.1.8). It is because we have assumed that the input is constant during each sampling period in dis- cretizing the state equation as if a S/H (sampler and zero-order-hold) device were installed at the input stage. Interested readers are invited to run the above program “sig08e03.m”, check the validity of the above results, and see how the MATLAB commands can be used to discretize a continuous-time state equation.

374 8 State Space Analysis of LTI Systems Remark 8.1 Discretized State Equation and Zero-Order-Hold Equivalent

The z.o.h. (step-invariant) equivalent of a continuous-time system has the same transfer function with the discrete-time system obtained by discretizing the state and output equations.

Example 8.4 Discretization of a Double Integrator

Consider the continuous-time LTI system described by the state and output equations as

u (t ) (E8.4.1)

For this system, we have

= 0s −1 (E8.4.3)

so that the state transition matrix is

{[s I − A] } B.8(3),(4) = 0 1 for t ≥ 0 (E8.4.4)

Thus we can use Eqs. (8.4.6a) and (8.4.6b) to get the system and input coefficient matrices for the discretized state equation as

(8.4.6a)

(8.4.6b) T

8.4.2 State Equation with Time Delay

A continuous-time LTI system with the input u(t ) delayed by d [s] can be described by

x ′ (t ) = Ax(t) + Bu(t − d)

(8.4.9) There are two cases: (i) 0 < d ≤ T (ii) T < d = M T + d 1 with 0 < d 1 < T and

M ≥ 1. <Case I> 0≤d≤T

When the time delay d is not longer than the sampling period T , i.e.,

0 < d ≤ T , the second term of the RHS of Eqs. (8.4.4) or (8.4.5) becomes

8.4 Discretization of Continuous-Time State Equation 375

(n+1)T

φ (nT + T − τ )Bu(τ − d)dτ

nT

nT +d

= φ (nT + T − σ )dσ Bu(nT − T )

nT nT +T

φ (nT + T − σ )dσ Bu(nT ) (8.4.10)

nT +d

where the input signal u(t ) is assumed to be constant over each sampling interval. Thus Eq. (8.4.5) becomes

x[n + 1] = A D x[n] + B D 1 u[n − 1] + B D 0 u[n] (8.4.11) where

A (8.4.6a)

D = φ(T ) = e AT

(8.4.12a)

(8.4.6b) nT +d

φ (τ )dτ B (8.4.12c)

T −d

This can be written in the form of state equation as

D B D 1 x[n] D 0 u[n]

= u[n] (8.4.13)

I where K extra state variables u[n − 1] representing the past input values are

u[n − 1]

introduced to augment the state vector. <Case II> T<d=MT+d 1 with 0 < d 1 < T and M ≥ 1

When the time delay d is longer than the sampling period T so that d = MT+d 1 with 0 < d 1 < T and some integer M ≥ 1, Eq. (8.4.11) becomes

x[n + 1] = A D x[n] + B D 1 u[n − M − 1] + B D 0 u[n − M] (8.4.14) where the matrices A D , B D 1 , and B D 0 are as defined by Eqs. (8.4.12a,b,c).

This can be written in the form of state equation as

376 8 State Space Analysis of LTI Systems ⎡

⎤ ⎡ ⎤ ⎡ x[n + 1] ⎤ A D B D 1 B D 0 O···O x[n] O ⎢ u[n − M] ⎥

I O···O ⎥ ⎢ u[n − M − 1] ⎥ ⎢ ⎥ ⎥ ⎢ ⎥ ⎢ O ⎥ ⎢

⎥ ⎢ u[n]

• ⎥ ⎢ • ⎥ ⎥ ⎣ u[n − 1] ⎦

⎣ O O OO···I ⎦ ⎣ u[n − 2] ⎦ ⎣ O ⎦ u[n]

I (8.4.15) where (M + 1)K extra state variables {u[n − 1], u[n − 2], · · · , u[n − M − 1]} representing the past input values are introduced.

O O OO···O

Fig. 8.1 Delayed input signal by d

Example 8.5 Discretization of a Double Integrator with Time Delay Consider the double integrator dealt with in Example 8.4, where the input is delayed by d (0 < d < T ). With the state transition matrix φ(t ) given by Eq. (E8.4.4), we use Eq. (8.4.12) to get the discrete-time system matrices as

A D = φ(T ) =

(E8.5.1)

B D 1 = φ(T − d) φ (τ )dτ B = (E8.5.2)

T −d

T −d

B D 0 = φ (τ )dτ B = (E8.5.3)

0 T−d