MaplePortal/TransferFunctions - Maple Help

 Transfer Functions

 Introduction

The DynamicSystems package contains many tools for manipulating transfer functions, and visualizing their response in both the time and frequency domain.

Here, we demonstrate how to define a transfer function, generate a phase plot, and convert a transfer function to the time domain. Much more is possible.

 Define a Transfer Function

 > $\mathrm{restart}:\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}\mathrm{with}\left(\mathrm{DynamicSystems}\right):$
 > $\mathrm{tf}≔\frac{s}{a\cdot {s}^{2}+b\cdot s+c}:$

Define a transfer function object

 > $\mathrm{sysTF}≔\mathrm{TransferFunction}\left(\mathrm{tf},\mathrm{parameters}=\left[a=1,b=1,c=1\right]\right)$
 ${\mathrm{sysTF}}{≔}\left[\begin{array}{c}{\mathbf{Transfer Function}}\\ {\mathrm{continuous}}\\ {\mathrm{1 output\left(s\right); 1 input\left(s\right)}}\\ {\mathrm{inputvariable}}{=}\left[{\mathrm{u1}}{}\left({s}\right)\right]\\ {\mathrm{outputvariable}}{=}\left[{\mathrm{y1}}{}\left({s}\right)\right]\end{array}\right$ (1)

 Generate a Phase Plot

 > $\mathrm{PhasePlot}\left(\mathrm{sysTF},\mathrm{parameters}=\left[a=3,b=4,c=5\right]\right)$

 Convert Transfer Function to a Differential Equation

 > $\mathrm{sysDE}≔\mathrm{DiffEquation}\left(\mathrm{tf}\right)$
 ${\mathrm{sysDE}}{≔}\left[\begin{array}{c}{\mathbf{Diff. Equation}}\\ {\mathrm{continuous}}\\ {\mathrm{1 output\left(s\right); 1 input\left(s\right)}}\\ {\mathrm{inputvariable}}{=}\left[{\mathrm{u1}}{}\left({t}\right)\right]\\ {\mathrm{outputvariable}}{=}\left[{\mathrm{y1}}{}\left({t}\right)\right]\end{array}\right$ (2)
 > $\mathrm{sysDE}:-\mathrm{de}$
 $\left[\frac{{ⅆ}}{{ⅆ}{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{\mathrm{x1}}{}\left({t}\right){=}{-}\frac{{a}{}{\mathrm{x2}}{}\left({t}\right)}{{b}}{,}\frac{{ⅆ}}{{ⅆ}{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{\mathrm{x2}}{}\left({t}\right){=}\frac{{c}{}{b}{}{\mathrm{x1}}{}\left({t}\right)}{{{a}}^{{2}}}{-}\frac{{b}{}{\mathrm{x2}}{}\left({t}\right)}{{a}}{-}\frac{{b}{}{\mathrm{u1}}{}\left({t}\right)}{{a}}{,}{\mathrm{y1}}{}\left({t}\right){=}{-}\frac{{\mathrm{x2}}{}\left({t}\right)}{{b}}\right]$ (3)



 Discretization and Time-Domain Response to an Input Signal

Sampling time and number of samples

 > $\mathrm{Ts}≔0.025:\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}\mathrm{Ns}≔1000:\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}$

Generate the input signal

 > $\mathrm{NoisyInput}≔\mathrm{Chirp}\left(1,0.02,0.01,\mathrm{hertz}=\mathrm{true},\mathrm{discrete}=\mathrm{true},\mathrm{samplecount}=\mathrm{Ns},\mathrm{sampletime}=\mathrm{Ts}\right)+\mathrm{Statistics}:-\mathrm{Sample}{\left(\mathrm{Normal}\left(0,0.05\right),\mathrm{Ns}\right)}^{\mathrm{%T}}:$

Discretize the transfer function

 > $\mathrm{sysTFD}≔\mathrm{ToDiscrete}\left(\mathrm{sysTF},\mathrm{Ts}\right)$
 ${\mathrm{sysTFD}}{≔}\left[\begin{array}{c}{\mathbf{Transfer Function}}\\ {\mathrm{discrete; sampletime = .25e-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]\end{array}\right$ (4)

Simulate and plot the response

 >
 > $\mathrm{plot}\left(\left[\mathrm{seq}\left(\left[\left(i-1\right)\cdot \mathrm{Ts},\mathrm{OutputResponse}\left[i\right]\right],i=1..\mathrm{Ns}\right)\right]\right)$

 Applications