Plotting

# Plotting functions

`fig = bodeplot(sys, args...)`, `bodeplot(LTISystem[sys1, sys2...], args...; plotphase=true, kwargs...)`

Create a Bode plot of the `LTISystem`(s). A frequency vector `w` can be optionally provided.

`kwargs` is sent as argument to Plots.plot.

source

`fig = gangoffourplot(P::LTISystem, C::LTISystem)`, `gangoffourplot(P::Union{Vector, LTISystem}, C::Vector; plotphase=false)`

Gang-of-Four plot.

`kwargs` is sent as argument to Plots.plot.

source
``impulseplot(sys[, Tf[,  Ts]])``

Plot step response of `sys` with optional final time `Tf` and discretization time `Ts`. If not defined, suitable values are chosen based on `sys`.

source

Plot the phase advance as a function of `N` for a lead link (phase advance link)

If an input argument `s` is given, the curve is plotted from `s` to 10, else from 1 to 10.

See also `Leadlink, leadlinkat`

source

`fig = lsimplot(sys::LTISystem, u, t; x0=0, method)`

`lsimplot(LTISystem[sys1, sys2...], u, t; x0, method)`

Calculate the time response of the `LTISystem`(s) to input `u`. If `x0` is not specified, a zero vector is used.

Continuous time systems are discretized before simulation. By default, the method is chosen based on the smoothness of the input signal. Optionally, the `method` parameter can be specified as either `:zoh` or `:foh`.

source

`fig = marginplot(sys::LTISystem [,w::AbstractVector]; kwargs...)`, `marginplot(sys::Vector{LTISystem}, w::AbstractVector; kwargs...)`

Plot all the amplitude and phase margins of the system(s) `sys`. A frequency vector `w` can be optionally provided.

`kwargs` is sent as argument to Plots.plot.

source

fig = `nicholsplot{T<:LTISystem}(systems::Vector{T}, w::AbstractVector; kwargs...)`

Create a Nichols plot of the `LTISystem`(s). A frequency vector `w` can be optionally provided.

Keyword arguments:

``````text = true
Gains = [12, 6, 3, 1, 0.5, -0.5, -1, -3, -6, -10, -20, -40, -60]
pInc = 30
sat = 0.4
val = 0.85
fontsize = 10``````

`pInc` determines the increment in degrees between phase lines.

`sat` ∈ [0,1] determines the saturation of the gain lines

`val` ∈ [0,1] determines the brightness of the gain lines

Additional keyword arguments are sent to the function plotting the systems and can be used to specify colors, line styles etc. using regular Plots.jl syntax

This function is based on code subject to the two-clause BSD licence Copyright 2011 Will Robertson Copyright 2011 Philipp Allgeuer

source

`fig = nyquistplot(sys; gaincircles=true, kwargs...)`, `nyquistplot(LTISystem[sys1, sys2...]; gaincircles=true, kwargs...)`

Create a Nyquist plot of the `LTISystem`(s). A frequency vector `w` can be optionally provided.

`gaincircles` plots the circles corresponding to |S(iω)| = 1 and |T(iω)| = 1, where S and T are the sensitivity and complementary sensitivity functions.

`kwargs` is sent as argument to plot.

source

Plots interesting figures related to closing the loop around process `P` with a PID controller Send in a bunch of PID-parameters in any of the vectors kp, ki, kd. The vectors must be the same length.

`time` indicates whether or not the parameters are given as gains (default) or as time constants

`series` indicates whether or not the series form or parallel form (default) is desired

Available plots are `:gof` for Gang of four, `:nyquist`, `:controller` for a bode plot of the controller TF and `:pz` for pole-zero maps

One can also supply a frequency vector ω to be used in Bode and Nyquist plots

`pidplots(P, args...; kps=0, kis=0, kds=0, time=false, series=false, ω=0)`

See also `loopshapingPI`, `stabregionPID`

source

`fig = pzmap(fig, system, args...; kwargs...)`

Create a pole-zero map of the `LTISystem`(s) in figure `fig`, `args` and `kwargs` will be sent to the `scatter` plot command.

source
``rlocusplot(P::LTISystem, K)``

Computes and plots the root locus of the SISO LTISystem P with a negative feedback loop and feedback gains `K`, if `K` is not provided, range(1e-6,stop=500,length=10000) is used. If `OrdinaryDiffEq.jl` is installed and loaded by the user (`using OrdinaryDiffEq`), `rlocusplot` will use an adaptive step-size algorithm to select values of `K`. A scalar `Kmax` can then be given as second argument.

source

`sigmaplot(sys, args...)`, `sigmaplot(LTISystem[sys1, sys2...], args...)`

Plot the singular values of the frequency response of the `LTISystem`(s). A frequency vector `w` can be optionally provided.

`kwargs` is sent as argument to Plots.plot.

source

`setPlotScale(str)`

Set the default scale of magnitude in `bodeplot` and `sigmaplot`. `str` should be either `"dB"` or `"log10"`.

source
``stepplot(sys[, Tf[,  Ts]])``

Plot step response of `sys` with optional final time `Tf` and discretization time `Ts`. If not defined, suitable values are chosen based on `sys`.

source