delta

Download Delta

If you can't read please download the document

Upload: ricardo-souza

Post on 26-Oct-2014

42 views

Category:

Documents


7 download

TRANSCRIPT

Delta Indexbalanced models Bode plots c2del canonical forms controllability conversions delay delbalre design discrete-time estimator frequency response gramian H-in nity impulse response Kalman lter LQG Lyapunov equation models Nichols plots Nyquist plots observability optimal control regulator Riccati equation simulation step response time response 14 15 8 10,30 30 4,6 9 14 5 3,4 24 17 19 20 22 24 24 19 5 26 27 30 20,24 24 20,24 22,29 22 22,29

34

z2del

z2del

Purpose:

Conversion of discrete time shift models to discrete time delta models.

Synopsis:da,db,dc,dd]=z2del(za,zb,zc,zd,delta) dnum,dden]=z2del(znum,zden,delta)

Description:

z2del DA,DB,DC,DD]=z2del(ZA,ZB,ZC,ZD,delta)

converts from discrete time z domain models to discrete time delta domain models. converts the discrete shift system: qx = ZAx + ZBu y = ZCx + ZDu

to the discrete delta system: x = DAx + DBu y = DCx + DDu using delta as the sampling period.DNUM,DDEN]=z2del(ZNUM,ZDEN,delta)

converts the discrete system descibed by: G(z) = ZNUM(z) ZDEN(z)

to the discrete time system: G( ) = DNUM( )) DDEN(

Algorithm:z2del

is implemented in an M- le.

See also:del2z,c2del,del2c,c2d,d2c

References:Section 3.5.3

Digital Control and Estimation : A Uni ed Approach

1] Middleton,R.H. and Goodwin,G.C.

33

tfadd,tfmult

tfadd,tfmult

Purpose:

Addition and multiplication of transfer functions.

Synopsis:num,den]=tfadd(num1,den1,num2,den2) num,den]=tfmult(num1,den1,num2,den2)

Description:NUM,DEN]=tfadd(NUM1,NUM1,DEN2,DEN2)

adds together two transfer functions to give a third.

NUM = NUM1 + NUM2 DEN DEN1 DEN2 NUM,DEN]=tfmult(NUM1,NUM1,DEN2,DEN2) multiplies together two transfer functions to give a third. NUM = NUM1 NUM2 DEN DEN1 DEN2

Algorithm:tfadd

and tfmult are M- les. They both convert the transfer functions into state space form and then add or multiply, then convert back.

32

s2del

s2del

Purpose:

Maps matrices and vectors from the continuous s plane to the discrete delta plane.

Synopsis:y=s2del(s,delta)

Description:s2del Y=s2del(S,delta) S

maps points from the continuous s plane to the discrete delta plane. Y=eS

Given , a matrix, returns: I where delta is the sampling period and e is the matrix exponential. Given S, a vector, returns: Y (i) = e where delta is the sampling period.s2del is an M- le. If S is a matrix the matrix exponential is calculated using a Pade approximation, otherwise the vector is calculated point by point.

S (i)

1

Algorithm:

See also:c2del

References:Section 3.5.3

Digital Control and Estimation : A Uni ed Approach

1] Middleton,R.H. and Goodwin,G.C.

31

lctrb,lobsv

lctrb,lobsv

Purpose:

Linearly independent controllability and observability matrices.

Synopsis:co=lctrb(a,b) ob=lobsv(a,c)

Description:CO=lctrb(A,B)

returns the controllability matrix of the system: x = Ax + Bu

such that the columns are linearly independent. OB=lobsv(A,C) returns the observability matrix of the system: x = Ax + Bu y = Cx + Du such that the rows are linearly independent.lctrb and lobsv are M- les. They use ctrb and obsv to nd the controllability and observability matrices and then use rref to remove the linearly dependent columns or rows.

Algorithm:

See also:ctrb,obsv

References:

Digital Control and Estimation : A Uni ed Approach

1] Middleton,R.H. and Goodwin,G.C.

Sections 8.3 and 8.8

30

delsim

delsim

Purpose:

Simulation of discrete time systems in delta domain.

Synopsis:y,x]=delsim(a,b,c,d,u,delta,x0) y,x]=delsim(num,den,u,delta,x0)

calculates the response of discrete time linear systems in delta domain to arbitrary inputs. Given the LTI system: x = Ax + Bu y = Cx + Du and the input matrix U, with as many rows as there are inputs and each column corresponding to a new time point, spaced by delta, the sampling period. With X0 specifying the initial conditions of the states, Y is returned with as many rows as there are outputs and with length(U) columns. Upon exit X contains the state history and has as many rows as there are states and length(U) columns. If X0 is unspeci ed it is assumed to be zero. Y,X]=delsim(NUM,DEN,U,delta,X0) returns the response of the system given by: G( ) = NUM( )) DEN(delsim Y,X]=delsim(A,B,C,D,U,delta,X0)

Description:

Example

Simulate the response of the system:

2 + 5s + H(s) = 2s2 + 2s + 31 s to a sine wave, for 10 seconds, in discrete time with a sample period of 0.1.num= 2,5,1]; den= 1,2,3]; num,den]=c2del(num,den,0.1); t=(0:0.1:10); u=sin(t); y,x]=delsim(num,den,u,0.1); plot(t,y);

Algorithm:delsim

is an M- le. The response of the states of the system to the input are propagated taking advantage of the numerical advantages of the delta transform, then the output is found directly. This routine is not a kernel routine of matlab and hence is slower than the equivalent routine for z transforms.

See also:delimp,delstep

29

See also:delfreq,logspace,unwrap

References:Section 6.2

Digital Control and Estimation : A Uni ed Approach

1] Middleton,R.H. and Goodwin,G.C.

28

delnyq

delnyq

Purpose:

Nyquist frequency response plots of discrete time delta systems.

Synopsis:re,im,w]=delnyq(a,b,c,d,iu,delta) re,im,w]=delnyq(num,den,delta)

delnyq calculates the frequency response of a discrete time LTI system in delta domain then, automatically selecting the appropriate frequency range, plots the nyquist diagram. RE,IM,W]=delnyq(A,B,C,D,iu,delta) calculates the frequency response of the system: x = Ax + Bu y = Cx + Du from the iu'th input using delta as the sampling period. delnyq returns the matrices RE and IM with as many rows as there are outputs and length(W) columns. Upon exit W contains the frequency points used in the bode plot. G( ) = C( I A) 1 B + D

Description:

re(!) = real(G( eRE,IM,W]=delnyq(NUM,DEN,delta)

j! j!

1 )) 1 ))

im(!) = imag(G( e description: G( ) = NUM( )) DEN(

calculates the frequency response from the transfer function

and plots it as a nyquist diagram.

Example

Plot the Nyquist diagram step of a second order system with a natural frequency !n = 1, a damping factor of = 0:2, and a sample time of 0.1 using the delta operator.a,b,c,d]=ord2(1,0.2); a,b,c,d]=c2del(a,b,c,d,0.1); re,im,w]=delnyq(a,b,c,d,1,0.1);

delnyq is an M- le. The routine delfreq is used to calculate the frequency response of the system over a preset frequency range and the resulted is plotted. The routine uses unwrap to ensure that the phase remains smooth and doesn't jump from 180 degrees to -180 degrees. If it is desired to enter your own frequency range,27 delfreq and then plot the results manually. use

Algorithm:

delnic

delnic

Purpose:

Nichols frequency response plots of discrete time delta systems.

Synopsis:mag,pha,w]=delnic(a,b,c,d,iu,delta) mag,pha,w]=delnic(num,den,delta)

delnic calculates the frequency response of a discrete time LTI system in delta domain then, automatically selecting the appropriate frequency range, plots the nichols diagram. MAG,PHA,W]=delnic(A,B,C,D,iu,delta) calculates the frequency response of the system:

Description:

x = Ax + Bu y = Cx + Du from the iu'th input using delta as the sampling period. delnic returns the matrices MAG and PHA (in degrees) with as many rows as there are outputs and length(W) columns. Upon exit W contains the frequency points used in the bode plot. G( ) = C( I A) 1 B + D mag(!) = abs(G( ej! j!

1 )) 1 ))

pha(!) = angle(G( e description:MAG,PHA,W]=delnic(NUM,DEN,delta)

calculates the frequency response from the transfer function

G( ) = NUM( )) DEN( and plots it as a nichols diagram.delnic is an M- le. The routine delfreq is used to calculate the frequency response of the system over a preset frequency range. The routine uses unwrap to ensure that the phase remains smooth and doesn't jump from 180 degrees to -180 degrees. If it is desired to enter your own frequency range, use delfreq and then plot the results manually.

Algorithm:

See also:delfreq,logspace,unwrap

26

A number of assumptions must be met for a unique positive de nite solution to exist for the LQR problem: 1. Matrix Q must be symmetric and positive semide nite. 2. Matrix R must be symmetric and positive de nite. 3. (A,B) must be stabilisable. 4. (A,C) must be detectable. 5. (A,H) must be detectable,where H'H=Q and rank(H)=rank(Q) Note also that if the hamiltonian matrix has repeated eigenvalues it will not be possible to decompose the matrix and hence the method will fail.

Limitations:

Algorithm:dellqr

and dellqe are M- les. They use eigenvector decomposition of the associated Hamiltonian matrix to solve the Riccati equation.

See also:lqr,lqe

References:Chapter 10 and 11

Digital Control and Estimation : A Uni ed Approach

1] Middleton,R.H. and Goodwin,G.C.

25

dellqe,dellqr

dellqe,dellqr

Purpose:

Discrete time delta domain linear quadratic estimator design. Discrete time delta domain linear quadratic regulator design.

Synopsis:h,p]=dellqe(a,c,ohm,gamma,delta,nn) l,s]=dellqr(a,b,q,r,delta,nn)

dellqr and dellqe solve the delta domain discrete time linear quadratic regulator (backslash) estimator problems and their associated Riccati equations. L,S]=dellqr(A,B,Q,R,delta,N) calculates the optimal feedback gain matrix L such that the feedback law: u = Lx minimises the cost function:

Description:

J = x(tf )0 x(tf ) + subject to the constraint:L

Z tf t0

(x(t)0Qx(t) + u(t)0 Ru(t))dt

L = (R + B 0SB) 1 B 0 S(I + A ) where S is given by the Riccati equation: 0 = Q + A0 S + SA + A0SA L0 (R + B 0SB)LH,P]=dellqe(A,C,Q,R,delta,N)

is given by:

x = Ax + Bu

Given the system: where

is used for linear quadratic estimator design in delta domain. x = Ax + v1 y = Cx + v2

Q=E v1v1']/delta, R=delta*E v2v2'], N=E v1v2']/delta returns the gain matrix H such that the delta domain discrete time Kalman lter:

x = A^ + H y C^] ^ x x produces an optimal estimate of x in the LQG sense. H is given by: H = ( A + I)PC 0 + N] CPC 0 + R] 1 where P is given by the Riccati equation: 0 = Q + PA0 + AP + AP A0 H R + CPC 0]H 0 For both dellqe and dellqr the cross weighting matrix, N, between Q and R may be incorporated or left out as desired. 24

See also:delsim,lmsim,dlsim

23

delimp,delstep

delimp,delstep

Purpose:

Discrete time delta impulse response. Discrete time delta step response.

Synopsis:y,x]=delimp(a,b,c,d,iu,t,delta) y,x]=delimp(num,den,t,delta) y,x]=delstep(a,b,c,d,iu,t,delta) y,x]=delstep(num,den,t,delta)

Description:delimp

and delstep calculate the impulse and step response of discrete time linear systems in delta domain. Y,X]=delimp(A,B,C,D,iu,T,delta) given the LTI system: x = Ax + Bu y = Cx + Du the ouput matrix,Y, returns with the impulse response of the system found from the iu'th input. T is the time vector over which the response is desired to be found and must be regularly spaced by delta, the sampling period. Upon output Y has as many columns as there are outputs and length(T) rows. X contains the state history of the system. Y,X]=delimp(NUM,DEN,T,delta) nds the impulse response of the system: G( ) = NUM( )) DEN( delstep is identical to delimp except that it returns the step response rather than the impulse response. Plot the step response from 0 to 10 seconds of a second order system with a natural frequency !n = 1, a damping factor of = 0:2, and a sample time of 0.1 using the delta operator.a,b,c,d]=ord2(1,0.2); a,b,c,d]=c2del(a,b,c,d,0.1); t= 0:0.1:10]; y,x]=delstep(a,b,c,d,1,t,0.1); plot(t,y);

Example

delimp and delstep are M- les. The impulse response is found by setting the initial conditions to B then nding the zero input response of the system using the numerical advantages of the delta transform. The step response is found by cascading an integrator in series with the system and then calling delimp. As these routines are not implemented in the kernel of matlab, unlike z domain simulations, they are not as quick as the z domain routines. 22

Algorithm:

Algorithm:delhinf

is an M- le. The algorithm used to solve the Riccati equation is eigenvector decomposition of the associated Hamiltonian matrix. The value of alpha that is used is the smallest value of alpha possible such that the solution matrix P found satis es the Riccati equation. Alpha is found by repeatedly decreasing the value of alpha from an initial large value, determined by the ratio of the norms of B1 and B2, and solving for P, until P no longer sati es the Riccati equation.

See also:lqe,lqr,dellqe,dellqr

References:

with Applications to H 1

1] Lee,L , Goodwin,G.C. and Kolodziej,W Interconnections between Continuous and Discrete Games

21

delhinf

delhinf

Purpose:

Solution of discrete time delta domain game problems.

Synopsis:p,l,q,alpha]=delhinf(a,b1,b2,c,delta)

Description:Given the system:

1 delhinf P,L,Q,alpha]=delhinf(A,B1,B2,C,delta)

uses the ideas of H to nd a solution to the discrete time, delta domain game problem. x = Ax + B1w + B2u z = Cx + Du

and the sampling period, delta, the optimum gain matrices L and Q are calculated so that with: u = Lx w = Qx the cost function: is minimised. L and Q are given by: J(u; w) = 1 k z k2 2 22 k w k2 2

L = B20 I P 2 B1B10 B2B20 1 P(I + A) 2B10 I Q = P 2B1B10 B2B20 1 P(I + A)2B1B10 B2B20 P 1 2B1B10 B2B20 P(I + A)

where P is given by the Riccati equation: 0 = C 0C + A0 P + PA + A0PA + (I + A)0 P I

Also returned is the value of alpha that the routine used to nd the gain matrices. Alpha provides a limit on the norm of the transfer function from w to z.

A number of assumptions must be met for a unique solution of the Riccati equation to exist and for the method of solution to work. 1. A,B2] must be stabilizable 2. C,A] must be detectable 3. (I + A) 1 must exist Additionally the solution matrix P must be found to be positive semi-de nite or else the result is meaningless. 20

Limitations

delgram

delgram

Purpose:

Discrete time delta domain controllability and observability gramians.

Synopsis:p=delgram(a,b,delta)

Description:delgram

nds the controllability and observability gramians in delta domain using the discrete time delta domain form of the Lyapunov equation. P=delgram(A,B,delta) returns the controllability gramian. P=delgram(A',C',delta) returns the observability gramian.

Algorithm:delgram

is an M- le. The delta domain form of the Lyapunov equation is: AP + PA0 + AP A0 = BB 0

Using the transformation: Ac = I + 2 A the equation can be put into the form:1

1

A1

Ac P + PA0c = I + 2 A BB 0 I + 2 A0 Now the existing lyap function can be used to solve the problem.

The Lyapunov equation has a unique solution provided A is asymptotically stable. i.e. the eigenvalues, i , of A satisfy Re( i ) + 2 j ij2 < 0.

Limitations: References:

Digital Control and Estimation : A Uni ed Approach

1] Middleton,R.H. and Goodwin,G.C.

Section 8.5 and 8.9

19

delfreq is an M- le. It uses a Hessenberg algorithm to solve for the frequency response. First the A,B,C,D matrices are balanced and A reduced to upper Hessenberg form. Then the linear equation j! 1 I A) 1B + D C( e

Algorithm:

is solved directly for each frequency point, taking advantage of the Hessenberg form.

See also:delbode,delnyq,delnic,logspace

References:Section 6.2

Digital Control and Estimation : A Uni ed Approach

1] Middleton,R.H. and Goodwin,G.C.

18

delfreq

delfreq

Purpose:

Frequency response of discrete time linear system in delta domain.

Synopsis:h=delfreq(a,b,c,d,iu,w,delta)

calculates the frequency response of a discrete time delta domain system which can then be used for various di erent frequency domain plots, such as Bode,Nyquist and Nichols. H=delfreq(A,B,C,D,iu,W,delta) calculates the frequency response of the system: x = Ax + Bu y = Cx + Du That is, returns: j! 1) H( edelfreq

Description:

where H( ) = C( I A) 1 B + D The response is calculated from the iu'th input and delta is used as the sampling period. The vector W must initially contain the frequencies, in radians, at which the response is to be evaluated. The elements of W should not exceed the folding frequency i.e. ! < 2 . Upon exit the matrix H has as many columns as there are outputs and length(W) rows. H=delfreq(NUM,DEN,W,delta) calculates the frequency response from the transfer function description: H( ) = NUM( )) DEN( where NUM and DEN contain the polynomial coe cients in descending powers. Plot the magnitude and phase responses from ! = 0:1 up to ! = 100 of a second order system with a natural frequency !n = 1, a damping factor of = 0:2, and a sample time of 0.1 using the delta operator.a,b,c,d]=ord2(1,0.2); a,b,c,d]=c2del(a,b,c,d,0.1); w=logspace(-1,2); h=delfreq(a,b,c,d,1,w,0.1); mag=abs(h); pha=angle(h)*180/pi; loglog(w,mag),title('Magnitude response'); semilogx(w,pha),title('Phase response');

Example

which results in the bode diagram being displayed on the screen. 17

is an M- le. It rst calculates the frequency range required by nding all the poles of the system and then ensuring that the range extends from 0.2 times the lowest pole up to 6 times the largest pole in the system. Next the frequency range is found using logspace to get logarithmically spaced points. The routine delfreq is then used to calculate the frequency response of the system and the resulted is plotted. The routine uses unwrap to ensure that the phase remains smooth and doesn't jump from 180 degrees to -180 degrees. If it is desired to enter your own frequency range, use delfreq and then plot the results manually.delbode

Algorithm:

See also:delfreq,logspace,unwrap

References:Section 6.2

Digital Control and Estimation : A Uni ed Approach

1] Middleton,R.H. and Goodwin,G.C.

16

delbode

delbode

Purpose:

Bode frequency response plots of discrete time delta systems.

Synopsis:mag,pha,w]=delbode(a,b,c,d,iu,delta) mag,pha,w]=delbode(num,den,delta)

Description:delbode

calculates the frequency response of a discrete time LTI system in delta domain then, automatically selecting the appropriate frequency range, plots the bode diagram. MAG,PHA,W]=delbode(A,B,C,D,iu,delta) calculates the frequency response of the system: x = Ax + Bu y = Cx + Dudelbode length(W)

from the iu'th input using delta as the sampling period. returns the matrices MAG and PHA (in degrees) with as many rows as there are outputs and columns. Upon exit W contains the frequency points used in the bode plot. G( ) = C( I A) 1 B + D mag(!) = abs(G( ej! j!

1 )) 1 ))

pha(!) = angle(G( e description:MAG,PHA,W]=delbode(NUM,DEN,delta)

calculates the frequency response from the transfer function

G( ) = NUM( )) DEN( and plots it as a bode diagram.

Example

Plot the magnitude and phase responses of a second order system with a natural frequency !n = 1, a damping factor of = 0:2, and a sample time of 0.1 using the delta operator.a,b,c,d]=ord2(1,0.2); a,b,c,d]=c2del(a,b,c,d,0.1); mag,pha,w]=delbode(a,b,c,d,1,0.1);

which results in the bode diagram being displayed on the screen.

15

delbalre

delbalre

Purpose:

Balanced state space realization and model reduction in discrete time using delta domain.

Synopsis:ab,bb,cb,m,t]=delbalre(a,b,c,delta)

nds an equivalent state space realization that has equal and diagonal controllability and observability gramians. This system is then in a convenient form for model order reduction. AB,BB,CB,M,T]=delbalre(A,B,C,delta) returns the balanced versions of A,B and C, a vector M containing the diagonal of the gramian of the balanced realization (the Hankel singular values), and the matrix T used in the similarity transformation.delbalre

Description:

Algorithm:delbalre

is an M- le and uses the algorithm outlined in 1]. This involves using Cholesky Factorization and singular value decomposition for symmetric matrices. The A matrix must have all its eigenvalues within the stability region. Also the system must be controllable and observable.

Limitations:

See also:balreal,modred,minreal,gram

References:Section 8.11

Digital Control and Estimation : A Uni ed Approach

1] Middleton,R.H. and Goodwin,G.C.

14

del2z

del2z

Purpose:

Conversion of discrete time delta models to discrete time shift models.

Synopsis:za,zb,zc,zd]=del2z(da,db,dc,dd,delta) znum,zden]=del2z(dnum,dden,delta)

Description:

del2z ZA,ZB,ZC,ZD]=del2z(DA,DB,DC,DD,delta)

converts from discrete time delta domain models to discrete time z domain models. converts the discrete delta system: x = DAx + DBu y = DCx + DDu

to the discrete shift system: qx = ZAx + ZBu y = ZCx + ZDu using delta as the sampling period.ZNUM,ZDEN]=del2z(DNUM,DDEN,delta)

converts the discrete system descibed by: G( ) = DNUM( )) DDEN( G(z) = NUM(z) DEN(z)

to the discrete time system:

Algorithm:del2z

is implemented in an M- le.

See also:z2del,c2del,del2c,c2d,d2c

References:Section 3.5.3

Digital Control and Estimation : A Uni ed Approach

1] Middleton,R.H. and Goodwin,G.C.

13

del2c

del2c

Purpose:

Conversion of discrete time delta domain models to continuous time models.

Synopsis:a,b,c,d]=del2c(da,db,dc,dd,delta) num,den]=del2c(dnum,dden,delta)

converts from discrete time domain models to continuous time models using the delta transform and assuming a zero-order hold on the inputs. A,B,C,D]=del2c(DA,DB,DC,DD,delta) converts the discrete system: x = DAx + DBu y = DCx + DDu to the continuous system:del2c

Description:

x = Ax + Bu _ y = Cx + Du using delta as the sampling period.NUM,DEN]=del2c(DNUM,DDEN,delta)

converts the discrete system described by: G( ) = DNUM( )) DDEN( G(s) = NUM(s) DEN(s)

to the discrete time system:

del2c is implemented in an M- le. The calculation uses a matrix logarithm which is calculated via Parlett's method in the function logm.

Algorithm:

Limitations See also:c2del,logm

For del2c to work the real part of the eigenvalues of DA should not be in the range ( 1; 1 ].

References:Section 3.5.3

Digital Control and Estimation : A Uni ed Approach

1] Middleton,R.H. and Goodwin,G.C.

12

References:

Digital Control and Estimation : A Uni ed Approach

1] Middleton,R.H. and Goodwin,G.C.

Section 8.4.2 and 8.8.2

11

ctrlf,obsrf

ctrlf,obsrf

Purpose:

Controller and observer form.

Synopsis:ac,bc,cc,p]=ctrlf(a,b,c) ao,bo,co,p]=obsrf(a,b,c)

Description:

uses a similarity transform to convert a state space system into canonical controller form. uses a similarity transform to convert a state space system into canonical observer form. determines the similarity transformation matrix P such that the transformation x = P x puts the system:ctrlf obsrf AC,BC,CC,P]=ctrlf(A,B,C)

x = Ax + Bu y = Cx + Du in the form: x =2 6 6 6 6 4

1 : : : 0 1 : : : 0 : : 1 y = Cx + Du2

n

1 : : :

0 0 : 0

0

3

1 6 0 7 7 7 6 7 7x+6 0 7u 7 6 7 4 0 5 5 0

2

3

system in the form:

AC,BC,CC,P]=obsrf(A,B,C)

is similar to the controller form except the transformation puts the6 6 6 6 4 7 0 1 7 : : 7 x + Bu 7 : 15 0 0 : : 0 1 0 : : 0 x + Du

x = y =

: : :

n

1 1 0 : 0

3

Algorithm:ctrlf

is an M- le. The similarity transform matrix is found by determining the controllability matrix and then post multiplying by a matrix whose form is dependent on the controllability matrix found. obsrf uses duality with the controller form.

Limitationsctrlf

does not work with multiple inputs and obsrf does not work with multiple outputs.

See also:ctrb,obsv,ctrbf,obsvf

10

c2deld

c2deld

Purpose:

Conversion of a continuous time model with a time delay to a discrete time delta model.

Synopsis:da,db,dc,dd]=c2deld(a,b,c,d,delay,delta) dnum,dden]=c2deld(num,den,delay,delta)

Description:c2deld

converts from continuous domain models incorporation a time delay to discrete time domain models using the delta transform and assuming a zero-order hold on the inputs. The time delay is modelled exactly in discrete time by increasing the order of the resulting system. DA,DB,DC,DD]=c2del(A,B,C,D,delay,delta) converts the continuous system: x = Ax + Bu _ y = Cx + Du with a time delay that is delay seconds long on each on the inputs, to the discrete time system: x = DAx + DBu y = DCx + DDu using delta as the sampling period.DNUM,DDEN]=c2deld(NUM,DEN,delay,delta)

converts the continuous system described by: G(s) = NUM(s) e (delay)s DEN(s) G( ) = DNUM( )) DDEN(

to the discrete time system:

Algorithm:c2deld

is implemented in an M- le and uses the algorithm from 1]. The calculation uses matrix exponentials which are calculated via Pade approximation in the function expm.

See also:c2del

References:Section 6.4.2

Digital Control and Estimation : A Uni ed Approach

1] Middleton,R.H. and Goodwin,G.C.

9

c2del

c2del

Purpose:

Conversion of a continuous time model to a discrete time delta model.

Synopsis:da,db,dc,dd]=c2del(a,b,c,d,delta) dnum,dden]=c2del(num,den,delta)

Description:c2del

converts from continuous domain models to discrete time domain models using the delta transform and assuming a zero-order hold on the inputs. DA,DB,DC,DD]=c2del(A,B,C,D,delta) converts the continuous system: x = Ax + Bu _ y = Cx + Du to the discrete time system: x = DAx + DBu y = DCx + DDu using delta as the sampling period.DNUM,DDEN]=c2del(NUM,DEN,delta)

converts the continuous system described by: G(s) = NUM(s) DEN(s)

to the discrete time system: G( ) = DNUM( )) DDEN(c2del is implemented in an M- le. The calculation uses a matrix exponential which is calculated via Pade approximation in the function expm.

Algorithm:

See also:expm,del2c,c2deld

References:Section 3.5.3

Digital Control and Estimation : A Uni ed Approach

1] Middleton,R.H. and Goodwin,G.C.

8

This section contains detailed descriptions of all DELTA TOOLBOX functions. It begins with a list of functions grouped by subject area and continues with the reference entries in alphabetical order. Information is also available through the on-line help facility. s2del c2del c2deld del2c del2z z2del MODEL CONVERSIONS s to plane conversion cont. to delta conversion using zero order hold cont. to delta for systems with a time delay discrete delta to continuous domain conversion discrete delta to discrete shift conversion discrete shift to discrete delta conversion

Delta Toolbox: Reference

delfreq delbode delnic delnyq

FREQUENCY RESPONSE frequency response of discrete system in delta domain bode plot of discrete system in delta domain nichols plot of discrete system in delta domain nyquist plot of discrete system in delta domain

TIME RESPONSE delsim response of discrete delta system to arbitrary input delimp impulse response of discrete delta system delstep step response of discrete delta system MODEL REALIZATIONS delbalre delta domain form of balanced state space realization ctrlf controller form obsrf observer form MODEL PROPERTIES delgram discrete delta form of controllability gramian lctrb controllability matrix with linearly independent columns lobsv observability matrix with linearly independent rows GAIN SELECTION dellqe discrete delta domain linear quadratic estimator design dellqr discrete delta domain linear quadratic regulator design delhinf discrete delta form of H 1 game problem UTILITY tfadd addition of two systems in transfer function form tfmult multiplication of two systems in transfer function form

7

Delta Toolbox: Referencec2del .................................................................8 c2deld .................................................................9 ctrlf .................................................................10 del2c .................................................................12 del2z .................................................................13 delbalre .................................................................14 delbode .................................................................15 delfreq .................................................................17 delgram .................................................................19 delhinf .................................................................20 delimp .................................................................22 dellqe .................................................................24 dellqr .................................................................24 delnic .................................................................26 delnyq .................................................................27 delsim .................................................................29 delstep .................................................................22 lctrb .................................................................30 lobsv .................................................................30 obsrf .................................................................10 s2del .................................................................31 tfadd .................................................................32 tfmult .................................................................32 z2del .................................................................33

6

5 References

Digital Control and Estimation : A Uni ed Approach

1] R.H Middleton and G.C Goodwin

Note that the references given in the CONTROL SYSTEM TOOLBOX are still relevant for numerical and general systems analysis. The single reference given here is all that is required for the conversion to delta domain.

5

The corresponding section in the CONTROL SYSTEM TOOLBOX is applicable to the new routines as for the old. The emphasis is on simple tools that are easy to understand and use. These tools however may break down when the system order is too large or the problem is ill formed. Some routines will solve a problem that is ill-conditioned providing results that are meaningless. It is therefore necessary to understand the problem that you are trying to solve when using the toolbox, as for other MATLAB toolboxes. This section is as for the CONTROL SYSTEM TOOLBOX except that one set of routines replaces the two sets, one for continuous time and one for discrete time, that provide the basic linear time and frequency domain analysis tools required for control system engineering. delfreq delbode delnic delnyq delsim delimp delstep delgram lctrb lobsv ANALYSIS FUNCTIONS frequency response of discrete system in delta domain bode plot of discrete system in delta domain nichols plot of discrete system in delta domain nyquist plot of discrete system in delta domain response of discrete delta system to arbitrary input impulse response of discrete delta system step response of discrete delta system discrete delta form of controllability gramian controllability matrix with linearly independent columns observability matrix with linearly independent rows

4.3 Reliable Computation

4.4 Analysis Functions

4.5 Model Order Reduction

Using the delta operator some pairs of model order reduction routines can be replaced. Additionally a new form of model realization is introduced. MODEL REALISATIONS delbalre delta domain form of balanced state space realization ctrlf controller form obsrf observer form

The linear quadratic routines are redone using the delta operator and a new gain selection routine using the ideas of H 1 is introduced. GAIN SELECTION dellqe discrete delta domain linear quadratic estimator design dellqr discrete delta domain linear quadratic regulator design delhinf discrete delta form of H 1 game problem

4.6 Design Functions

4

3 Installation

Instructions for installing the DELTA TOOLBOX are found in the section entitled Installing Toolboxes in the computer speci c section of the MATLAB user's guide. We recommend that you locate the les from this toolbox in a directory named delta o the control directory of the CONTROL SYSTEM TOOLBOX. The idea of the DELTA TOOLBOX extension to the CONTROL SYSTEM TOOLBOX is to replace the existing pairs of routines, one continuous and one discrete, by a single delta operator routine. All the delta routines have the input parameter delta corresponding to the sampling period. By setting delta to zero the continuous time case is selected and when delta is non-zero the discrete time case. In addition to the delta operator routines that are provided there are some extra routines of more general nature that are included. These are included to ll some of the gaps left by the CONTROL SYSTEM TOOLBOX. The current version of the DELTA TOOLBOX is only an extension to the existing toolbox to allow a familiarity and comparison phase before the delta routines replace completely the existing shift and continuous routines. Hence the existence of routines such as z2del which allow comparison of the performance of shift domain and delta domain routines. With the addition of the DELTA TOOLBOX to the CONTROL SYSTEM TOOLBOX all of the system models previously supported are still supported. The only modi cation is that the discrete time case can be represented in two ways, using shift as for the discrete time case in the CONTROL SYSTEM TOOLBOX, or using the delta operator. With the delta operator a system of LTI di erence equations can be represented in matrix or state space form by: xk = Axk + Buk yk = Cxk + Duk where u is a vector of control inputs, x is the state vector, and y is a vector of outputs. An equivalent representation using the delta transform is: Y ( ) = H( )U( ) where H( ) = C( I A) 1 B + D Otherwise all the comments on system models remain relevant. As for the System Models case all of the comments in the CONTROL SYSTEM TOOLBOX are pertinent. The only addition are a set of routines to allow conversion back and forth between the three di erent domains supported, the discrete time domain using delta, the discrete time shift operator domain, and the continuous domain. s2del c2del c2deld del2c del2z z2del MODEL CONVERSIONS s to plane conversion cont. to delta conversion using zero order hold cont. to delta for systems with a time delay discrete delta to continuous domain conversion discrete delta to discrete shift conversion discrete shift to discrete delta conversion 3

4 Integration With The Control Systems Toolbox

4.1 System Models

4.2 Model Conversions

MATLAB, through its linear algebra, matrix computation, and numerical analysis capabilities provides a good foundation for control theory system design and analysis. The CONTROL SYSTEM TOOLBOX, an extension of MATLAB, provides an extensive collection of routines for use by the control or systems engineer. The routines allow control systems to be modelled as transfer functions or in state space form, and provide conversion routines between the various model representations. Time response, frequency response, pole-placement, optimal control and estimation are all provided in the toolbox. The toolbox handles both continuous and discrete time systems. The CONTROL SYSTEM TOOLBOX therefore, is a very useful tool for any control or system engineer. A disadvantage with the CONTROL SYSTEM TOOLBOX is that the shift operator and ztransforms are used for discrete time systems. It has been shown extensively in the last few years 1] that the delta operator is superior to the shift operator for discrete time systems. The delta operator uni es continuous and discrete time theory such that discrete time results converge to the corresponding continuous time results as the sampling period is decreased and, in addition, provides improved numerical properties. The idea of the DELTA TOOLBOX then is to upgrade the CONTROL SYSTEM TOOLBOX using the delta operator such that each pair of existing routines, one continuous and one discrete, is replaced by one routine using the delta operator. The DELTA TOOLBOX is based very closely on the design of the CONTROL SYSTEM TOOLBOX and most of what is said in its tutorial is relevant to the DELTA TOOLBOX also. What follows is a brief explanation for the motivation behind the toolbox and then an explanation on how the toolbox integrates with the CONTROL SYSTEM TOOLBOX.

1 Introduction

Delta Toolbox: A Tutorial

A disadvantage with the CONTROL SYSTEM TOOLBOX is that, as the shift operator is used for discrete time, for each application there is one routine for continuous time and another for discrete time. Having a pair of routines for each task emphasises the di erences between discrete and continuous theory rather than the similarities. Also, note that as the sampling rate increases shift operators and z transforms have no continuous time counterpart. Use of the delta operator, however, ensures that the discrete time result converges to the corresponding continuous time result as the sampling rate is increased, thus continuous and discrete time theory are uni ed. A side bene t of the use of the delta operator is improved numerical properties over the shift operator. The shift and delta operators are related by: =q 1 One might initially think that some form of di erentiation is occurring and thus the numerical performance of the delta operator would be inferior to that of the shift operator. However, after extensive simulation studies and analysis, it was found that this was not the case, rather the delta operator gave improved relative performance. This was observed especially when the sampling period was small, the order of the systems very large, or the numerical calculations were performed in restricted wordlength. The reason for this is that in discrete time all the information about a system is contained in the distance that the poles and zeros of the system are from one. When using the shift operator however the physical numbers that are recorded by the computer are not these distances but the actual positions of the poles and zeros. When the sampling period is small, the systems order high, or nite word length arithmetic is used the numbers to be stored are very close to one and not suited to storage by a computer using oating point arithmetic. The delta operator solves the problem by subtracting one from the shift operator value (and then scaling). Hence for numbers very close to one, numbers very close to zero are generated, which are much easier to store using oating point arithmetic. Therefore delta operators retain information that is lost when using shift operators when oating point arithmetic is used, hence the improved performance under adverse conditions. It has since been proven mathematically that the delta operator is superior to the shift operator numerically. For a more detailed treatment on the advantages of the delta operator see reference 1]. 2

2 Advantages of Delta Over Shift

Delta Toolbox: A Tutorial1. 2. 3. 4.

Introduction Advantages Of Delta Over Shift Installation Integration With The Control Systems Toolbox4.1 4.2 4.3 4.4 4.5 4.6 System Models Model Conversions Reliable Computation Analysis Functions Model Order Reduction Design Functions

5. References

1

Delta ToolboxUsers Guide March 6, 1990