plot response of a system to a given input - Maple 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

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)$