DynamicSystems - Maple Help

Home : Support : Online Help : Science and Engineering : Dynamic Systems : System Object : DynamicSystems/Resample

DynamicSystems

 Resample
 resample a discrete-time system object

 Calling Sequence Resample(sys, T, opts)

Parameters

 sys - System; system object (discrete) T - algebraic; new sampling time opts - (optional) equation(s) of the form option = value; specify options for the Resample command

Options

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

Specifies the resampling method.

 • frequency = realcons

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

Description

 • The Resample command resamples a discrete-time system sys, discretized with sampling time sys:-sampletime, to create an equivalent discrete-time system with new sampling time T.
 • The method option specifies the resampling method. 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 resampling 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

 • For details on the transformation methods, see the sections Frequency Domain Transformations and Time Domain Transformations in DynamicSystems[ToContinuous] and DynamicSystems[ToDiscrete].

Examples

 > $\mathrm{with}\left(\mathrm{DynamicSystems}\right):$

Resample a discrete-time transfer function with new sampling time 0.001 s

 > $\mathrm{sys}≔\mathrm{ZeroPoleGain}\left(\left[0.7\right],\left[0.5\right],1,\mathrm{discrete},\mathrm{sampletime}=0.01\right):$
 > $\mathrm{sys}≔\mathrm{TransferFunction}\left(\mathrm{sys}\right):$$\mathrm{PrintSystem}\left(\mathrm{sys}\right)$
 $\left[\begin{array}{l}{\mathbf{Transfer Function}}\\ {\mathrm{discrete; sampletime = .1e-1}}\\ {\mathrm{1 output\left(s\right); 1 input\left(s\right)}}\\ {\mathrm{inputvariable}}{=}\left[{\mathrm{u1}}{}\left({z}\right)\right]\\ {\mathrm{outputvariable}}{=}\left[{\mathrm{y1}}{}\left({z}\right)\right]\\ {{\mathrm{tf}}}_{{1}{,}{1}}{=}\frac{{z}{-}{0.7000000000}}{{z}{-}{0.5000000000}}\end{array}\right$ (1)

New sampling time T

 > $T≔0.001$
 ${T}{:=}{0.001}$ (2)

The default method is bilinear when no method is specified.

 > $\mathrm{sys_1}≔\mathrm{Resample}\left(\mathrm{sys},T\right):$$\mathrm{PrintSystem}\left(\mathrm{sys_1}\right)$
 $\left[\begin{array}{l}{\mathbf{Transfer Function}}\\ {\mathrm{discrete; sampletime = .1e-2}}\\ {\mathrm{1 output\left(s\right); 1 input\left(s\right)}}\\ {\mathrm{inputvariable}}{=}\left[{\mathrm{u1}}{}\left({z}\right)\right]\\ {\mathrm{outputvariable}}{=}\left[{\mathrm{y1}}{}\left({z}\right)\right]\\ {{\mathrm{tf}}}_{{1}{,}{1}}{=}\frac{{1.116129032}{}\left({z}{-}{0.9653179191}\right)}{{z}{-}{0.9354838710}}\end{array}\right$ (3)

Resampling with the original sampling time, we obtain the original discrete-time system.

 > $\mathrm{sys_orig}≔\mathrm{Resample}\left(\mathrm{sys_1},0.01\right):$$\mathrm{PrintSystem}\left(\mathrm{sys_orig}\right)$
 $\left[\begin{array}{l}{\mathbf{Transfer Function}}\\ {\mathrm{discrete; sampletime = .1e-1}}\\ {\mathrm{1 output\left(s\right); 1 input\left(s\right)}}\\ {\mathrm{inputvariable}}{=}\left[{\mathrm{u1}}{}\left({z}\right)\right]\\ {\mathrm{outputvariable}}{=}\left[{\mathrm{y1}}{}\left({z}\right)\right]\\ {{\mathrm{tf}}}_{{1}{,}{1}}{=}\frac{{z}{-}{0.7000000000}}{{z}{-}{0.5000000000}}\end{array}\right$ (4)
 > $\mathrm{sys_2}≔\mathrm{Resample}\left(\mathrm{sys},T,\mathrm{method}=\mathrm{forward}\right):$$\mathrm{PrintSystem}\left(\mathrm{sys_2}\right)$
 $\left[\begin{array}{l}{\mathbf{Transfer Function}}\\ {\mathrm{discrete; sampletime = .1e-2}}\\ {\mathrm{1 output\left(s\right); 1 input\left(s\right)}}\\ {\mathrm{inputvariable}}{=}\left[{\mathrm{u1}}{}\left({z}\right)\right]\\ {\mathrm{outputvariable}}{=}\left[{\mathrm{y1}}{}\left({z}\right)\right]\\ {{\mathrm{tf}}}_{{1}{,}{1}}{=}\frac{{z}{-}{0.9700000000}}{{z}{-}{0.9500000000}}\end{array}\right$ (5)
 > $\mathrm{sys_3}≔\mathrm{Resample}\left(\mathrm{sys},T,\mathrm{method}=\mathrm{backward}\right):$$\mathrm{PrintSystem}\left(\mathrm{sys_3}\right)$
 $\left[\begin{array}{l}{\mathbf{Transfer Function}}\\ {\mathrm{discrete; sampletime = .1e-2}}\\ {\mathrm{1 output\left(s\right); 1 input\left(s\right)}}\\ {\mathrm{inputvariable}}{=}\left[{\mathrm{u1}}{}\left({z}\right)\right]\\ {\mathrm{outputvariable}}{=}\left[{\mathrm{y1}}{}\left({z}\right)\right]\\ {{\mathrm{tf}}}_{{1}{,}{1}}{=}\frac{{1.327272727}{}\left({z}{-}{0.9589041096}\right)}{{z}{-}{0.9090909091}}\end{array}\right$ (6)
 > $\mathrm{sys_4}≔\mathrm{Resample}\left(\mathrm{sys},T,\mathrm{method}=\mathrm{prewarp},\mathrm{frequency}=2\right):$$\mathrm{PrintSystem}\left(\mathrm{sys_4}\right)$
 $\left[\begin{array}{l}{\mathbf{Transfer Function}}\\ {\mathrm{discrete; sampletime = .1e-2}}\\ {\mathrm{1 output\left(s\right); 1 input\left(s\right)}}\\ {\mathrm{inputvariable}}{=}\left[{\mathrm{u1}}{}\left({z}\right)\right]\\ {\mathrm{outputvariable}}{=}\left[{\mathrm{y1}}{}\left({z}\right)\right]\\ {{\mathrm{tf}}}_{{1}{,}{1}}{=}\frac{{1.116129582}{}\left({z}{-}{0.9653190438}\right)}{{z}{-}{0.9354859315}}\end{array}\right$ (7)
 > $\mathrm{sys_5}≔\mathrm{Resample}\left(\mathrm{sys},T,\mathrm{method}=\mathrm{zoh}\right):$$\mathrm{PrintSystem}\left(\mathrm{sys_5}\right)$
 $\left[\begin{array}{l}{\mathbf{Transfer Function}}\\ {\mathrm{discrete; sampletime = .1e-2}}\\ {\mathrm{1 output\left(s\right); 1 input\left(s\right)}}\\ {\mathrm{inputvariable}}{=}\left[{\mathrm{u1}}{}\left({z}\right)\right]\\ {\mathrm{outputvariable}}{=}\left[{\mathrm{y1}}{}\left({z}\right)\right]\\ {{\mathrm{tf}}}_{{1}{,}{1}}{=}\frac{{z}{-}{0.9598197951}}{{z}{-}{0.9330329923}}\end{array}\right$ (8)
 > $\mathrm{sys_6}≔\mathrm{Resample}\left(\mathrm{sys},T,\mathrm{method}=\mathrm{foh}\right):$$\mathrm{PrintSystem}\left(\mathrm{sys_6}\right)$
 $\left[\begin{array}{l}{\mathbf{Transfer Function}}\\ {\mathrm{discrete; sampletime = .1e-2}}\\ {\mathrm{1 output\left(s\right); 1 input\left(s\right)}}\\ {\mathrm{inputvariable}}{=}\left[{\mathrm{u1}}{}\left({z}\right)\right]\\ {\mathrm{outputvariable}}{=}\left[{\mathrm{y1}}{}\left({z}\right)\right]\\ {{\mathrm{tf}}}_{{1}{,}{1}}{=}\frac{{1.135736061}{}\left({z}{-}{0.9646218847}\right)}{{z}{-}{0.9330329923}}\end{array}\right$ (9)

Compare the frequency responses of all the systems.

 > $\mathrm{p0}≔\mathrm{MagnitudePlot}\left(\mathrm{sys},\mathrm{range}=0.1..10,\mathrm{color}=\mathrm{red},\mathrm{thickness}=2,\mathrm{legend}="discrete"\right):$
 > $\mathrm{p1}≔\mathrm{MagnitudePlot}\left(\mathrm{sys_1},\mathrm{range}=0.1..100,\mathrm{color}=\mathrm{blue},\mathrm{legend}="bilinear"\right):$
 > $\mathrm{p2}≔\mathrm{MagnitudePlot}\left(\mathrm{sys_2},\mathrm{range}=0.1..100,\mathrm{color}=\mathrm{green},\mathrm{legend}="forward"\right):$
 > $\mathrm{p3}≔\mathrm{MagnitudePlot}\left(\mathrm{sys_3},\mathrm{range}=0.1..100,\mathrm{color}=\mathrm{cyan},\mathrm{legend}="backward"\right):$
 > $\mathrm{p4}≔\mathrm{MagnitudePlot}\left(\mathrm{sys_4},\mathrm{range}=0.1..100,\mathrm{color}=\mathrm{grey},\mathrm{legend}="prewarp"\right):$
 > $\mathrm{p5}≔\mathrm{MagnitudePlot}\left(\mathrm{sys_5},\mathrm{range}=0.1..100,\mathrm{color}=\mathrm{magenta},\mathrm{legend}="zoh"\right):$
 > $\mathrm{p6}≔\mathrm{MagnitudePlot}\left(\mathrm{sys_6},\mathrm{range}=0.1..100,\mathrm{color}=\mathrm{black},\mathrm{legend}="foh"\right):$
 > $\mathrm{plots}[\mathrm{display}]\left(\mathrm{p0},\mathrm{p1},\mathrm{p2},\mathrm{p3},\mathrm{p4},\mathrm{p5},\mathrm{p6}\right)$

Compatibility

 • The DynamicSystems[Resample] command was introduced in Maple 18.