ToDiscrete - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


DynamicSystems

  

ToDiscrete

  

discretize a system object

 

Calling Sequence

Parameters

Options

Description

Examples

Compatibility

Calling Sequence

ToDiscrete (sys, T, opts)

Parameters

sys

-

System; system object to discretize

T

-

(optional) algebraic; sampling time

opts

-

(optional) equation(s) of the form option = value; specify options for the ToDiscrete command

Options

• 

method = forward, backward, bilinear, prewarp, matched, zoh, or foh

  

Specifies the method used to discretize the system.

• 

frequency = realcons

  

Specifies the warping or critical frequency in rad/s. This is used only if method = prewarp, otherwise it is ignored.

Description

• 

The ToDiscrete command converts a continuous system, sys, to a discrete system.

• 

The optional parameter T is the sampling time. If not symbolic it must evaluate to a positive number. The default value is set by the sampletime option to DynamicSystems[SystemOptions].

• 

The method option specifies the method of discretization. The following methods are supported: forward rectangle rule (forward), backward rectangle rule (backward), bilinear rule (bilinear), bilinear with prewarping (prewarp), matched poles and zeros (matched), zero-order hold (zoh), and first-order hold or non-causal triangle-hold (foh).

• 

The bilinear rule is also known as the Tustin or Trapezoid rule.

• 

Not all discretization methods can be applied to all system types. The following table describes the usage. An x indicates that the method can be used by the system type. A D indicates that the method is the default for the system type.

System Type

forward

backward

bilinear

prewarp

matched

zoh

foh

 

 

 

 

 

 

 

 

State-Space

   x

   x

   D

 

 

 x

 x

Transfer-Function

   x

   x

   D

   x

 

 x

 x

Coefficients

   x

   x

   D

   x

 

 x

 x

Zero-Pole-Gain

 

 

 

 

   D

 

 

Diff-Equation

   D

   x

 

 

 

 

 

Transformations

Frequency Domain Transformations

The frequency-domain transformations convert rational functions in s to rational functions in z, where s and z are the continuous and discrete complex frequency variables, respectively. The following paragraphs describe the mapping from the s plane to the z plane for each of the defined transformations.

• 

forward  : s -> (z-1)/T

• 

backward : s -> (z-1)/z/T

• 

bilinear : s -> 2*(z-1)/(z+1)/T

• 

prewarp  : s -> (z-1)/(z+1)/(tan(ω*T/2)/ω) where ω is the critical frequency in rad/s.

• 

matched  : poles and zeros in the s-plane map to the z-plane as s -> exp(s*T) = z; zeros at infinity map to -1; the gain at DC is matched.  If system has a pole at DC, then the match frequency is arbitrarily chosen.

The z-transform Z is used in the following hold equivalents:

• 

zoh : H(z) = (1-z^(-1))*Z{H(s)/s}

• 

foh : H(z) = (z-1)^2/z/T*Z{H(s)/s^2}

Time Domain Transformations

The time-domain transformations are done on the state-space matrices. The following describes each of the transformations (the foh and zoh transformations handle singular A matrices). The primed matrices represent the transformed matrices. I is the identity matrix.

• 

forward

A' = I + A*T

B' = B*T

C' = C

D' = D

• 

backward

A' = (I - A*T)^(-1)

B' = A'.B*T

C' = C.A'

D' = D + C'.B*T

• 

bilinear

M = (I - A*T/2)^(-1)

A' = (I + A*T/2).M

B' = M.B*sqrt(T)

C' = C.M*sqrt(T)

D' = D + sqrt(T)/2*C'.B

• 

zoh

A' = exp(A*T)

B' = A^(-1).(exp(A*T) - I).B

C' = C

D' = D

• 

foh

A' = exp(A*T)

B' = A^(-2)/T.(exp(A*T) - I)^2.B

C' = C

D' = D + C.(A^(-2)/T.(exp(A*T) - I) - A^(-1)).B

Examples

withDynamicSystems:

sysTransferFunction2s3+s2+1s3+2s2+s10:PrintSystemsys

Transfer Functioncontinuous1 output(s); 1 input(s)inputvariable=u1soutputvariable=y1stf1,1=2s3+s2+1s3+2s2+s10

(1)

Sampling time T

T0.1

T0.1

(2)

sys_z1ToDiscretesys,T,method=forward:PrintSystemsys_z1

Transfer Functiondiscrete; sampletime = .11 output(s); 1 input(s)inputvariable=u1zoutputvariable=y1ztf1,1=2.z32.950000000z2+2.900000000z0.9495000000z32.800000000z2+2.610000000z0.8200000000

(3)

sys_z2ToDiscretesys,T,method=backward:PrintSystemsys_z2

Transfer Functiondiscrete; sampletime = .11 output(s); 1 input(s)inputvariable=u1zoutputvariable=y1ztf1,1=1.750833333z32.950975726z2+2.903379343z0.9519276535z32.841666667z2+2.666666667z0.8333333333

(4)

sys_z3ToDiscretesys,T,method=bilinear:PrintSystemsys_z3

Transfer Functiondiscrete; sampletime = .11 output(s); 1 input(s)inputvariable=u1zoutputvariable=y1ztf1,1=1.861634506z32.950856655z2+2.902444973z0.9511005426z32.816118048z2+2.627695800z0.8206583428

(5)

sys_z4ToDiscretesys,T,method=prewarp,frequency=0.3:PrintSystemsys_z4

Transfer Functiondiscrete; sampletime = .11 output(s); 1 input(s)inputvariable=u1zoutputvariable=y1ztf1,1=1.861625101z32.950853005z2+2.902437835z0.9510969468z32.816105866z2+2.627669763z0.8206464690

(6)

sys_z5ToDiscretesys,T,method=zoh:PrintSystemsys_z5

Transfer Functiondiscrete; sampletime = .11 output(s); 1 input(s)inputvariable=u1zoutputvariable=y1ztf1,1=2.z32.953151801z2+2.902122691z0.9485180932z32.814354067z2+2.624028879z0.8187307530

(7)

sys_z6ToDiscretesys,T,method=foh:PrintSystemsys_z6

Transfer Functiondiscrete; sampletime = .11 output(s); 1 input(s)inputvariable=u1zoutputvariable=y1ztf1,1=8.187307539×10−10z4+2.268487496×109z36.692346287×109z2+6.580907699×109z2.155942816×109z32.814354067z2+2.624028879z0.8187307530

(8)

Compare the frequency responses of the four systems.

p0MagnitudePlotsys,range=0.1..10,color=red,thickness=2,legend=continuous:

p1MagnitudePlotsys_z1,range=0.1..10,color=blue,legend=forward:

p2MagnitudePlotsys_z2,range=0.1..10,color=green,legend=backward:

p3MagnitudePlotsys_z3,range=0.1..10,color=black,legend=bilinear:

p4MagnitudePlotsys_z4,range=0.1..10,color=grey,legend=prewarp:

p5MagnitudePlotsys_z5,range=0.1..10,color=cyan,legend=zoh:

p6MagnitudePlotsys_z6,range=0.1..10,color=magenta,legend=foh:

plotsdisplayp0,p1,p2,p3,p4,p5,p6

Compatibility

• 

The DynamicSystems[ToDiscrete] command was updated in Maple 18.

• 

The method option was updated in Maple 18.

See Also

DynamicSystems

DynamicSystems[Resample]

DynamicSystems[SystemOptions]

DynamicSystems[ToContinuous]