Analysis

# Analysis

`P = covar(sys, W)`

Calculate the stationary covariance `P = E[y(t)y(t)']` of an lti-model `sys`, driven by gaussian white noise 'w' of covariance `E[w(t)w(τ)]=W*δ(t-τ)` where δ is the dirac delta.

The ouput is if Inf if the system is unstable. Passing white noise directly to the output will result in infinite covariance in the corresponding outputs (DWD' .!= 0) for contunuous systems.

source
``covar(C,W)``

If `C` is a matrix, return CWC'

source

`ctrb(A, B)` or `ctrb(sys)`

Compute the controllability matrix for the system described by `(A, B)` or `sys`.

Note that checking for controllability by computing the rank from `ctrb` is not the most numerically accurate way, a better method is checking if `gram(sys, :c)` is positive definite.

source

`Wn, zeta, ps = damp(sys)`

Compute the natural frequencies, `Wn`, and damping ratios, `zeta`, of the poles, `ps`, of `sys`

source

`dampreport(sys)`

Display a report of the poles, damping ratio, natural frequency, and time constant of the system `sys`

source

`dcgain(sys)`

Compute the dcgain of system `sys`.

equal to G(0) for continuous-time systems and G(1) for discrete-time systems.

source

`dₘ = delaymargin(G::LTISystem)`

Only supports SISO systems

source

`S,D,N,T = gangoffour(P,C)`, `gangoffour(P::AbstractVector,C::AbstractVector)`

Given a transfer function describing the Plant `P` and a transferfunction describing the controller `C`, computes the four transfer functions in the Gang-of-Four.

`S = 1/(1+PC)` Sensitivity function

`D = P/(1+PC)`

`N = C/(1+PC)`

`T = PC/(1+PC)` Complementary sensitivity function

Only supports SISO systems

source

`S, D, N, T, RY, RU, RE = gangofseven(P,C,F)`

Given transfer functions describing the Plant `P`, the controller `C` and a feed forward block `F`, computes the four transfer functions in the Gang-of-Four and the transferfunctions corresponding to the feed forward.

`S = 1/(1+PC)` Sensitivity function

`D = P/(1+PC)`

`N = C/(1+PC)`

`T = PC/(1+PC)` Complementary sensitivity function

`RY = PCF/(1+PC)`

`RU = CF/(1+P*C)`

`RE = F/(1+P*C)`

Only supports SISO systems

source

`gram(sys, opt)`

Compute the grammian of system `sys`. If `opt` is `:c`, computes the controllability grammian. If `opt` is `:o`, computes the observability grammian.

source

`ωgₘ, gₘ, ωϕₘ, ϕₘ = margin{S<:Real}(sys::LTISystem, w::AbstractVector{S}; full=false, allMargins=false)`

returns frequencies for gain margins, gain margins, frequencies for phase margins, phase margins

If `!allMargins`, return only the smallest margin

If `full` return also `fullPhase`

source

`markovparam(sys, n)`

Compute the `n`th markov parameter of state-space system `sys`. This is defined as the following:

`h(0) = D`

`h(n) = C*A^(n-1)*B`

source

`.. norm(sys, p=2; tol=1e-6)`

`norm(sys)` or `norm(sys,2)` computes the H2 norm of the LTI system `sys`.

`norm(sys, Inf)` computes the L∞ norm of the LTI system `sys`. The H∞ norm is the same as the L∞ for stable systems, and Inf for unstable systems. If the peak gain frequency is required as well, use the function `norminf` instead.

`tol` is an optional keyword argument, used only for the computation of L∞ norms. It represents the desired relative accuracy for the computed L∞ norm (this is not an absolute certificate however).

sys is first converted to a state space model if needed.

The L∞ norm computation implements the 'two-step algorithm' in: N.A. Bruinsma and M. Steinbuch, 'A fast algorithm to compute the H∞-norm of a transfer function matrix', Systems and Control Letters 14 (1990), pp. 287-293. For the discrete-time version, see, e.g.,: P. Bongers, O. Bosgra, M. Steinbuch, 'L∞-norm calculation for generalized state space systems in continuous and discrete time', American Control Conference, 1991.

source

`obsv(A, C)` or `obsv(sys)`

Compute the observability matrix for the system described by `(A, C)` or `sys`.

Note that checking for observability by computing the rank from `obsv` is not the most numerically accurate way, a better method is checking if `gram(sys, :o)` is positive definite.

source

`pole(sys)`

Compute the poles of system `sys`.

source

`sv, w = sigma(sys[, w])`

Compute the singular values of the frequency response of system `sys` at frequencies `w`

`sv` has size `(length(w), max(ny, nu))`

source

`fig, kp, ki = stabregionPID(P, [ω]; kd=0, doplot = true)`

Segments of the curve generated by this program is the boundary of the stability region for a process with transfer function P(s) The PID controller is assumed to be on the form kp +ki/s +kd s

The curve is found by analyzing P(s)*C(s) = -1 ⟹ |PC| = |P| |C| = 1 arg(P) + arg(C) = -π

If `P` is a function (e.g. s -> exp(-sqrt(s)) ), the stability of feedback loops using PI-controllers can be analyzed for processes with models with arbitrary analytic functions

See also `stabregionPID`, `loopshapingPI`, `pidplots`

source

`tzero(sys)`

Compute the invariant zeros of the system `sys`. If `sys` is a minimal realization, these are also the transmission zeros.

source

`z, p, k = zpkdata(sys)`

Compute the zeros, poles, and gains of system `sys`.

Returns

`z` : Matrix{Vector{ComplexF64}}, (ny x nu)

`p` : Matrix{Vector{ComplexF64}}, (ny x nu)

`k` : Matrix{Float64}, (ny x nu)

source