DynamicSystems - Maple Programming Help

Home : Support : Online Help : Science and Engineering : Dynamic Systems : Plotting and Graphical Tools : DynamicSystems/ResponsePlot

DynamicSystems

 ResponsePlot
 plot response of a system to a given input

 Calling Sequence ResponsePlot (sys, input, opts)

Parameters

 sys - System; system object to simulate input - algebraic, list(algebraic), Vector(realcons), or list(Vector(realcons)); input signal to the system opts - (optional) equation(s) of the form option = value; specify options for the ResponsePlot command

Options

Some options are used only with particular types of systems. If an option is not usable, it is ignored.

 • initialconditions = Vector(realcons) or list of equations

Specifies the initial conditions of the system. For a state-space system the initial conditions are specified as a Vector with dimension equal to the number of state-variables. For a differential-equation system the initial conditions are a list of equations. For transfer-function, coefficients, zero-pole-gain, and difference-equation (discrete DE) systems, initial conditions are ignored. Ignored initial conditions are equivalent to initial conditions of zero.

 • output = algebraic, list(algebraic), or listlist(algebraic)

Specifies the expressions to plot.

A single algebraic expression generates a plot of the expression versus time. The names of the system variables in the expression are replaced with their values at each instant of the solution. For example, for a continuous system with y1 as an output variable and  x1 as a state variable, the expression t*x1*y1^2 plots $t\mathrm{x1}\left(t\right){\mathrm{y1}\left(t\right)}^{2}$ versus $t$.

A list(algebraic) expression generates a multiplot of each element in the list versus time. The names of the system variables in the elements are replaced with their values at each instant of the solution. For example, for a discrete system with y1 and y2 as an output variables and u1 as an input variable, the list [y1, y2/u1] plots y1(q) versus q and y2(q)/u1(q) versus q.

A listlist(algebraic) expression generates a parametric multiplot, with each sublist specifying the coordinates of the corresponding plot. If the sublists contain two elements, then the plots are 2-D plane curves. If the sublists contain three elements, then the plots are 3-D space curves. The names of the system variables in the elements are replaced with their values at each instant of the solution. For example, for a continuous system with y1 and y2 as output variables, the listlist [[y1, y2]] plots $\mathrm{y1}\left(t\right)$ versus $\mathrm{y2}\left(t\right)$.

As described above, system variables are substituted for the corresponding names in the expressions. Continuous systems do not have access to the input variables, while discrete systems do.

The default is to plot all output variables of a system versus time.

 • parameters = set(name = complexcons) or list(name = complexcons)
 Specifies numeric values for parameters in sys. These values override those specified by the parameters field of the system object, which in turn override the settings in in SystemOptions(parameters). The numeric value on the right-hand side of each equation is substituted for the name on the left-hand side in the expressions that define the model. No checking is done during the substitution to determine whether the substituted value is valid. For example, a complex value can be substituted for the coefficient of a polynomial. If the complex value had been originally assigned to the model at creation, a warning would be generated.

Continuous System Options

 • dsolveargs = list( equation )

Specifies extra parameters to be passed to dsolve. The simulation is achieved by formulating the system as a set of differential equations and then passing them to dsolve.  With this option additional parameters can be passed to dsolve.  See dsolve/numeric/DAE for details.

 • duration = realcons

Specifies the duration of the simulation. The simulation starts at $t=0$ and proceeds until t = duration. The default value is assigned by DynamicSystems[SystemOptions].

Description

 • The ResponsePlot command plots the time response of sys, a System object, to a given input.
 • ResponsePlot uses DynamicSystems[Simulate] to generate the response, consequently, sys and input must be compatible with Simulate.
 • The ResponsePlot command takes all standard plot,options.

Examples

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

Create a linear system from a differential equation.

 > $\mathrm{deqs}≔\left[0.5\left(\frac{ⅆ}{ⅆt}i\left(t\right)\right)+i\left(t\right)=v\left(t\right)-0.01\left(\frac{ⅆ}{ⅆt}\mathrm{θ}\left(t\right)\right),0.01\left(\frac{ⅆ}{ⅆt}\left(\frac{ⅆ}{ⅆt}\mathrm{θ}\left(t\right)\right)\right)+0.1\left(\frac{ⅆ}{ⅆt}\mathrm{θ}\left(t\right)\right)=0.01i\left(t\right)\right]$
 ${\mathrm{deqs}}{≔}\left[{0.5}{}\left(\frac{{ⅆ}}{{ⅆ}{t}}{}{i}{}\left({t}\right)\right){+}{i}{}\left({t}\right){=}{v}{}\left({t}\right){-}{0.01}{}\left(\frac{{ⅆ}}{{ⅆ}{t}}{}{\mathrm{θ}}{}\left({t}\right)\right){,}{0.01}{}\left(\frac{{{ⅆ}}^{{2}}}{{ⅆ}{{t}}^{{2}}}{}{\mathrm{θ}}{}\left({t}\right)\right){+}{0.1}{}\left(\frac{{ⅆ}}{{ⅆ}{t}}{}{\mathrm{θ}}{}\left({t}\right)\right){=}{0.01}{}{i}{}\left({t}\right)\right]$ (1)
 > $\mathrm{sys}≔\mathrm{DiffEquation}\left(\mathrm{deqs},\mathrm{inputvariable}=\left[v\left(t\right)\right],\mathrm{outputvariable}=\left[\mathrm{θ}\left(t\right),i\left(t\right)\right]\right):$

Generate the input waveform, a sine wave with amplitude 1 and natural frequency of 2 radian/second.

 > $\mathrm{vin}≔\mathrm{Sine}\left(1,2\right)$
 ${\mathrm{vin}}{≔}{{}\begin{array}{cc}{0}& {t}{<}{0}\\ {\mathrm{sin}}{}\left({2}{}{t}\right)& {\mathrm{otherwise}}\end{array}$ (2)

Plot the response of the system to the input for a simulation time of 10 seconds.  This is the command to create the 2-D plot from the Plotting Guide.

 > $\mathrm{Tsim}≔10:$
 > $\mathrm{ResponsePlot}\left(\mathrm{sys},\mathrm{vin},\mathrm{duration}=\mathrm{Tsim},\mathrm{color}=\left[\mathrm{red},\mathrm{blue}\right],\mathrm{thickness}=2\right)$ Plot theta vs i as time varies over the duration.

 > $\mathrm{ResponsePlot}\left(\mathrm{sys},\mathrm{vin},\mathrm{duration}=\mathrm{Tsim},\mathrm{output}=\left[\left[i,\mathrm{θ}\right]\right]\right)$ Create a discrete simulation of the previous system. Convert sys to a sampled system with a sampling period, Ts,  of 0.1 second. Assign the default samplecount so that the duration corresponds to Tsim'.

 > $\mathrm{Ts}≔0.1:$
 > $\mathrm{SystemOptions}\left(\mathrm{sampletime}=\mathrm{Ts},\mathrm{samplecount}=\mathrm{round}\left(\frac{\mathrm{Tsim}}{\mathrm{Ts}}\right)\right):$
 > $\mathrm{sysz}≔\mathrm{ToDiscrete}\left(\mathrm{sys}\right)$
 ${\mathrm{sysz}}{≔}\left[\begin{array}{c}{\mathbf{Diff. Equation}}\\ {\mathrm{discrete; sampletime = .1}}\\ {\mathrm{2 output\left(s\right); 1 input\left(s\right)}}\\ {\mathrm{inputvariable}}{=}\left[{v}{}\left({q}\right)\right]\\ {\mathrm{outputvariable}}{=}\left[{\mathrm{\theta }}{}\left({q}\right){,}{i}{}\left({q}\right)\right]\end{array}\right$ (3)
 > $\mathrm{vin_z}≔\mathrm{Sine}\left(1,2,\mathrm{discrete}=\mathrm{true}\right)$
 ${\mathrm{vin_z}}{≔}\left[\begin{array}{c}{\mathrm{1 .. 100}}{\mathrm{Vector}}{[}{\mathrm{column}}{]}\\ {\mathrm{Data Type:}}{\mathrm{anything}}\\ {\mathrm{Storage:}}{\mathrm{rectangular}}\\ {\mathrm{Order:}}{\mathrm{Fortran_order}}\end{array}\right]$ (4)

Plot the response of the system, and the input.

 > $\mathrm{ResponsePlot}\left(\mathrm{sysz},\mathrm{vin_z},\mathrm{output}=\left[v,\mathrm{θ},i\right],\mathrm{color}=\left[\mathrm{red},\mathrm{blue},\mathrm{green}\right]\right)$ Plot the output state, versus time, as a space-curve.  This is the command to create the 3-D plot from the Plotting Guide.

 > $\mathrm{ResponsePlot}\left(\mathrm{sysz},\mathrm{vin_z},\mathrm{output}=\left[\left[q,\mathrm{θ},i\right]\right],\mathrm{axes}=\mathrm{normal}\right)$ 