Pole placement using Ackermann method
Call: K = acker(A, B, poles)
Parameters: | A, B : 2-d arrays
poles: 1-d list
|
---|---|
Returns: | K: matrix
|
Controllabilty matrix
Parameters: | A, B: array_like or string
|
---|---|
Returns: | C: matrix
|
Examples
>>> C = ctrb(A, B)
(X,L,G) = care(A,B,Q) solves the continuous-time algebraic Riccati equation
A^T X + X A - X B B^T X + Q = 0
where A and Q are square matrices of the same dimension. Further, Q is a symmetric matrix. The function returns the solution X, the gain matrix G = B^T X and the closed loop eigenvalues L, i.e., the eigenvalues of A - B G.
(X,L,G) = care(A,B,Q,R,S,E) solves the generalized continuous-time algebraic Riccati equation
A^T X E + E^T X A - (E^T X B + S) R^-1 (B^T X E + S^T) + Q = 0
where A, Q and E are square matrices of the same dimension. Further, Q and R are symmetric matrices. The function returns the solution X, the gain matrix G = R^-1 (B^T X E + S^T) and the closed loop eigenvalues L, i.e., the eigenvalues of A - B G , E.
(X,L,G) = dare(A,B,Q,R) solves the discrete-time algebraic Riccati equation
A^T X A - X - A^T X B (B^T X B + R)^-1 B^T X A + Q = 0
where A and Q are square matrices of the same dimension. Further, Q is a symmetric matrix. The function returns the solution X, the gain matrix G = (B^T X B + R)^-1 B^T X A and the closed loop eigenvalues L, i.e., the eigenvalues of A - B G.
(X,L,G) = dare(A,B,Q,R,S,E) solves the generalized discrete-time algebraic Riccati equation
- A^T X A - E^T X E - (A^T X B + S) (B^T X B + R)^-1 (B^T X A + S^T) +
- Q = 0
where A, Q and E are square matrices of the same dimension. Further, Q and R are symmetric matrices. The function returns the solution X, the gain matrix G = (B^T X B + R)^-1 (B^T X A + S^T) and the closed loop eigenvalues L, i.e., the eigenvalues of A - B G , E.
dlyap(A,Q) solves the discrete-time Lyapunov equation
A X A^T - X + Q = 0
where A and Q are square matrices of the same dimension. Further Q must be symmetric.
dlyap(A,Q,C) solves the Sylvester equation
A X Q^T - X + C = 0
where A and Q are square matrices.
dlyap(A,Q,None,E) solves the generalized discrete-time Lyapunov equation
A X A^T - E X E^T + Q = 0
where Q is a symmetric matrix and A, Q and E are square matrices of the same dimension.
Compute the gain of the system in steady state.
The function takes either 1, 2, 3, or 4 parameters:
Parameters: | A, B, C, D: array-like
Z, P, k: array-like, array-like, number
num, den: array-like
sys: Lti (StateSpace or TransferFunction)
|
---|---|
Returns: | gain: matrix
|
Notes
This function is only useful for systems with invertible system matrix A.
All systems are first converted to state space form. The function then computes:
Evaluate the transfer function of an LTI system for a single complex number x.
To evaluate at a frequency, enter x = omega*j, where omega is the frequency in radians
Parameters: | sys: StateSpace or TransferFunction
x: scalar
|
---|---|
Returns: | fresp: ndarray |
See also
freqresp, bode
Notes
This function is a wrapper for StateSpace.evalfr and TransferFunction.evalfr.
Examples
>>> sys = ss("1. -2; 3. -4", "5.; 7", "6. 8", "9.")
>>> evalfr(sys, 1j)
array([[ 44.8-21.4j]])
>>> # This is the transfer function matrix evaluated at s = i.
Todo
Add example with MIMO system
Gramian (controllability or observability)
Parameters: | sys: StateSpace
type: String
|
---|---|
Returns: | gram: array
|
Raises: | ValueError
ImportError
|
Examples
>>> Wc = gram(sys,'c')
>>> Wo = gram(sys,'o')
X = lyap(A,Q) solves the continuous-time Lyapunov equation
A X + X A^T + Q = 0
where A and Q are square matrices of the same dimension. Further, Q must be symmetric.
X = lyap(A,Q,C) solves the Sylvester equation
A X + X Q + C = 0
where A and Q are square matrices.
X = lyap(A,Q,None,E) solves the generalized continuous-time Lyapunov equation
A X E^T + E X A^T + Q = 0
where Q is a symmetric matrix and A, Q and E are square matrices of the same dimension.
Frequency response of an LTI system at multiple angular frequencies.
Parameters: | sys: StateSpace or TransferFunction
omega: array_like
|
---|---|
Returns: | mag: ndarray phase: ndarray omega: list, tuple, or ndarray |
See also
evalfr, bode
Notes
This function is a wrapper for StateSpace.freqresp and TransferFunction.freqresp. The output omega is a sorted version of the input omega.
Examples
>>> sys = ss("1. -2; 3. -4", "5.; 7", "6. 8", "9.")
>>> mag, phase, omega = freqresp(sys, [0.1, 1., 10.])
>>> mag
array([[[ 58.8576682 , 49.64876635, 13.40825927]]])
>>> phase
array([[[-0.05408304, -0.44563154, -0.66837155]]])
Todo
Add example with MIMO system
#>>> sys = rss(3, 2, 2) #>>> mag, phase, omega = freqresp(sys, [0.1, 1., 10.]) #>>> mag[0, 1, :] #array([ 55.43747231, 42.47766549, 1.97225895]) #>>> phase[1, 0, :] #array([-0.12611087, -1.14294316, 2.5764547 ]) #>>> # This is the magnitude of the frequency response from the 2nd #>>> # input to the 1st output, and the phase (in radians) of the #>>> # frequency response from the 1st input to the 2nd output, for #>>> # s = 0.1i, i, 10i.
Calculate gain and phase margins and associated crossover frequencies
Function margin takes either 1 or 3 parameters.
Parameters: | sys : StateSpace or TransferFunction
mag, phase, w : array_like
|
---|---|
Returns: | gm, pm, Wcg, Wcp : float
|
Examples
>>> sys = ss("1. -2; 3. -4", "5.; 7", "6. 8", "9.")
>>> gm, pm, wg, wp = margin(sys)
margin: no magnitude crossings found
Todo
better ecample system!
#>>> gm, pm, wg, wp = margin(mag, phase, w)
Calculate the first M Markov parameters [D CB CAB ...] from input U, output Y.
Parameters: | Y: array_like
U: array_like
M: integer
|
---|---|
Returns: | H: matrix
|
Notes
Currently only works for SISO
Examples
>>> H = markov(Y, U, M)
Observability matrix
Parameters: | A, C: array_like or string
|
---|---|
Returns: | O: matrix
|
Examples
>>> O = obsv(A, C)
Compute frequencies and gains at intersections with real axis in Nyquist plot.
Returns: | omega: 1d array of (non-negative) frequencies where Nyquist plot intersects the real axis gain: 1d array of corresponding gains |
---|
Examples
>>> tf = TransferFunction([1], [1, 2, 3, 4])
>>> PhaseCrossoverFrequenies(tf)
(array([ 1.73205081, 0. ]), array([-0.5 , 0.25]))
Compute system poles.
Parameters: | sys: StateSpace or TransferFunction
|
---|---|
Returns: | poles: ndarray
|
Raises: | NotImplementedError
|
See also
zero
Notes
This function is a wrapper for StateSpace.pole and TransferFunction.pole.
Calculate the root locus by finding the roots of 1+k*TF(s) where TF is self.num(s)/self.den(s) and each k is an element of kvect.
Parameters: | sys : linsys
kvect : gain_range (default = None)
Plot : boolean (default = True)
PrintGain: boolean (default = True)
Return values ————- rlist : list of computed root locations |
---|
Calculate gain, phase and stability margins and associated crossover frequencies.
Parameters: | sysdata: linsys or (mag, phase, omega) sequence
deg=True: boolean
returnall=False: boolean
epsw=1e-12: float
|
---|---|
Returns: | gm, pm, sm, wg, wp, ws: float or array_like
|
Compute system zeros.
Parameters: | sys: StateSpace or TransferFunction
|
---|---|
Returns: | zeros: ndarray
|
Raises: | NotImplementedError
|
See also
pole
Notes
This function is a wrapper for StateSpace.zero and TransferFunction.zero.