| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The Octave Control Systems Toolbox (OCST) was initially developed by Dr. A. Scottedward Hodel a.s.hodel@eng.auburn.edu with the assistance of his students
place.m).
An on-line menu-driven tutorial is available via DEMOcontrol;
beginning OCST users should start with this program.
octave:1> DEMOcontrol O C T A V E C O N T R O L S Y S T E M S T O O L B O X Octave Controls System Toolbox Demo [ 1] System representation [ 2] Block diagram manipulations [ 3] Frequency response functions [ 4] State space analysis functions [ 5] Root locus functions [ 6] LQG/H2/Hinfinity functions [ 7] End |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| 29.1.1 Variables common to all OCST system formats | ||
29.1.2 tf format variables | ||
29.1.3 zp format variables | ||
29.1.4 ss format variables |
The OCST stores all dynamic systems in a single data structure format that can represent continuous systems, discrete-systems, and mixed (hybrid) systems in state-space form, and can also represent purely continuous/discrete systems in either transfer function or pole-zero form. In order to provide more flexibility in treatment of discrete/hybrid systems, the OCST also keeps a record of which system outputs are sampled.
Octave structures are accessed with a syntax much like that used by the C programming language. For consistency in use of the data structure used in the OCST, it is recommended that the system structure access m-files be used (see section 29.2 System Construction and Interface Functions). Some elements of the data structure are absent depending on the internal system representation(s) used. More than one system representation can be used for SISO systems; the OCST m-files ensure that all representations used are consistent with one another.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The data structure elements (and variable types) common to all system
representations are listed below; examples of the initialization
and use of the system data structures are given in subsequent sections and
in the online demo DEMOcontrol.
This vector indicates both what representation was used to initialize the system data structure (called the primary system type) and which other representations are currently up-to-date with the primary system type (see section 29.2.5 Data structure access functions).
The value of the first element of the vector indicates the primary system type.
tf2sys or fir2sys)
zp2sys)
ss2sys)
The next three elements are boolean flags that indicate whether tf, zp,
or ss, respectively, are "up to date" (whether it is safe to use the
variables associated with these representations). These flags are
changed when calls are made to the sysupdate command.
indicates which outputs are discrete time (i.e., produced by D/A converters) and which are continuous time. yd(ii) = 0 if output ii is continuous, = 1 if discrete.
The remaining variables of the system data structure are only present
if the corresponding entry of the sys vector is true (=1).
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
tf format variables
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
zp format variables
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
ss format variables
Note some functions (e.g., bode, hinfsyn)
will not accept systems with both discrete and continuous states/outputs
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Construction and manipulations of the OCST system data structure (see section 29.1 System Data Structure) requires attention to many details in order to ensure that data structure contents remain consistent. Users are strongly encouraged to use the system interface functions in this section. Functions for the formatted display in of system data structures are given in 29.3 System display functions.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Inputs:
C(z) = c0 + c1*z^{-1} + c2*z^{-2} + ... + znz^{-n}
Outputs sys (system data structure)
Example
octave:1> sys = fir2sys([1 -1 2 4],0.342,"A/D input","filter output");
octave:2> sysout(sys)
Input(s)
1: A/D input
Output(s):
1: filter output (discrete)
Sampling interval: 0.342
transfer function form:
1*z^3 - 1*z^2 + 2*z^1 + 4
-------------------------
1*z^3 + 0*z^2 + 0*z^1 + 0
|
Extract FIR data from system data structure; see fir2sys for parameter descriptions.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Inputs
default: d = zero matrix
If tsam is 0, , .
If tsam is greater than zero, ,
see below for system partitioning
default (stname=[] on input): x_n for continuous states,
xd_n for discrete states
default (inname = [] on input): u_n
default (outname = [] on input): y_n
list of indices of outputs y that are sampled
If tsam is 0, .
If tsam is greater than 0, .
Unlike states, discrete/continous outputs may appear in any order.
Note sys2ss returns a vector yd where
yd(outlist) = 1; all other entries of yd are 0.
Outputs outsys = system data structure
System partitioning
Suppose for simplicity that outlist specified that the first several outputs were continuous and the remaining outputs were discrete. Then the system is partitioned as
x = [ xc ] (n x 1)
[ xd ] (nz x 1 discrete states)
a = [ acc acd ] b = [ bc ]
[ adc add ] [ bd ]
c = [ ccc ccd ] d = [ dc ]
[ cdc cdd ] [ dd ]
(cdc = c(outlist,1:n), etc.)
|
Signal partitions
| continuous | discrete | ---------------------------------------------------- states | stname(1:n,:) | stname((n+1):(n+nz),:) | ---------------------------------------------------- outputs | outname(cout,:) | outname(outlist,:) | ---------------------------------------------------- |
rows(p)
that are not contained in outlist. (Discrete/continuous outputs
may be entered in any order desired by the user.)
Example
octave:1> a = [1 2 3; 4 5 6; 7 8 10];
octave:2> b = [0 0 ; 0 1 ; 1 0];
octave:3> c = eye(3);
octave:4> sys = ss(a,b,c,[],0,3,0,list("volts","amps","joules"));
octave:5> sysout(sys);
Input(s)
1: u_1
2: u_2
Output(s):
1: y_1
2: y_2
3: y_3
state-space form:
3 continuous states, 0 discrete states
State(s):
1: volts
2: amps
3: joules
A matrix: 3 x 3
1 2 3
4 5 6
7 8 10
B matrix: 3 x 2
0 0
0 1
1 0
C matrix: 3 x 3
1 0 0
0 1 0
0 0 1
D matrix: 3 x 3
0 0
0 0
0 0
|
Inputs sys system data structure
Outputs
Example
octave:1> sys=tf2sys([1 2],[3 4 5]); octave:2> [a,b,c,d] = sys2ss(sys) a = 0.00000 1.00000 -1.66667 -1.33333 b = 0 1 c = 0.66667 0.33333 d = 0 |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Inputs
Outputs sys = system data structure
Example
octave:1> sys=tf2sys([2 1],[1 2 1],0.1);
octave:2> sysout(sys)
Input(s)
1: u_1
Output(s):
1: y_1 (discrete)
Sampling interval: 0.1
transfer function form:
2*z^1 + 1
-----------------
1*z^2 + 2*z^1 + 1
|
See tf for parameter descriptions.
Example
octave:1> sys=ss([1 -2; -1.1,-2.1],[0;1],[1 1]); octave:2> [num,den] = sys2tf(sys) num = 1.0000 -3.0000 den = 1.0000 1.1000 -4.3000 |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Inputs
Outputs sys: system data structure
Example
octave:1> sys=zp2sys([1 -1],[-2 -2 0],1);
octave:2> sysout(sys)
Input(s)
1: u_1
Output(s):
1: y_1
zero-pole form:
1 (s - 1) (s + 1)
-----------------
s (s + 2) (s + 2)
|
See zp for parameter descriptions.
Example
octave:1> sys=ss([1 -2; -1.1,-2.1],[0;1],[1 1]); octave:2> [zer,pol,k] = sys2zp(sys) zer = 3.0000 pol = -2.6953 1.5953 k = 1 |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
syssetsignals
Inputs
"all"
"cst"
"dst"
"in"
"out"
Outputs
Inputs
"in"
"out"
"st"
"yd"
sysidx
0
1
Outputs
sigid="in"
sigid="out"
sigid="st"
stage signals
sigid="yd"
"in",
"out", or "st"), or else the logical flag
indicating whether output(s) signum is(are) discrete (sigval=1)
or continuous (sigval=0).
Examples (From sysrepdemo)
octave> sys=ss(rand(4),rand(4,2),rand(3,4)); octave> [Ast,Ain,Aout,Ayd] = sysgetsignals(sys) i # get all signal names Ast = ( [1] = x_1 [2] = x_2 [3] = x_3 [4] = x_4 ) Ain = ( [1] = u_1 [2] = u_2 ) Aout = ( [1] = y_1 [2] = y_2 [3] = y_3 ) Ayd = 0 0 0 octave> Ain = sysgetsignals(sys,"in") # get only input signal names Ain = ( [1] = u_1 [2] = u_2 ) octave> Aout = sysgetsignals(sys,"out",2) # get name of output 2 (in cell array) Aout = ( [1] = y_2 ) octave> Aout = sysgetsignals(sys,"out",2,1) # get name of output 2 (as string) Aout = y_2 |
Inputs sys: system data structure
Outputs
systype: string indicating how the structure was initially
constructed:
values: "ss", "zp", or "tf"
Note FIR initialized systems return systype="tf".
"out"
"in"
"st"
"yd"
opt = "out", "in", or "st"
opt = "yd"
Default: replace entire cell array of names/entire yd vector.
Example
octave:1> sys=ss([1 2; 3 4],[5;6],[7 8]);
octave:2> sys = syssetsignals(sys,"st",str2mat("Posx","Velx"));
octave:3> sysout(sys)
Input(s)
1: u_1
Output(s):
1: y_1
state-space form:
2 continuous states, 0 discrete states
State(s):
1: Posx
2: Velx
A matrix: 2 x 2
1 2
3 4
B matrix: 2 x 1
5
6
C matrix: 1 x 2
7 8
D matrix: 1 x 1
0
|
Inputs
"tf"
"zp"
"ss"
"all"
Outputs retsys: contains union of data in sys and requested data. If requested data in sys is already up to date then retsys=sys.
Conversion to tf or zp exits with an error if the system is
mixed continuous/digital.
function [systype, nout, nin, ncstates, ndstates] = minfo(inmat)
MINFO: Determines the type of system matrix. INMAT can be a varying(*), system, constant, and empty matrix.
Returns: systype can be one of: varying, system, constant, and empty nout is the number of outputs of the system nin is the number of inputs of the system ncstates is the number of continuous states of the system ndstates is the number of discrete states of the system
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[]
"ss"
"tf"
"zp"
"all"
"s"
"s"
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
See section 29.7 System Analysis-Time Domain.
Unless otherwise noted, all parameters (input,output) are system data structures.
Form an arbitrary complex (open or closed loop) system in
state-space form from several systems. "buildssic" can
easily (despite it's cryptic syntax) integrate transfer functions
from a complex block diagram into a single system with one call.
This function is especially useful for building open loop
interconnections for H_infinity and H2 designs or for closing
loops with these controllers.
Although this function is general purpose, the use of "sysgroup"
"sysmult", "sysconnect" and the like is recommended for
standard operations since they can handle mixed discrete and continuous
systems and also the names of inputs, outputs, and states.
The parameters consist of 4 lists that describe the connections outputs and inputs and up to 8 systems s1-s8. Format of the lists:
Example:
[1 2 -1; 2 1 0] ==> new input 1 is old inpout 1
+ output 2 - output 1, new input 2 is old input 2
+ output 1. The order of rows is arbitrary.
Example: Very simple closed loop system.
w e +-----+ u +-----+
--->o--*-->| K |--*-->| G |--*---> y
^ | +-----+ | +-----+ |
- | | | |
| | +----------------> u
| | |
| +-------------------------|---> e
| |
+----------------------------+
|
The closed loop system GW can be optained by
GW = buildssic([1 2; 2 -1], 2, [1 2 3], 2, G, K); |
Here is a real example:
+----+
-------------------->| W1 |---> v1
z | +----+
----|-------------+ || GW || => min.
| | vz infty
| +---+ v +----+
*--->| G |--->O--*-->| W2 |---> v2
| +---+ | +----+
| |
| v
u y
|
The closed loop system GW from [z; u]' to [v1; v2; y]' can be obtained by (all SISO systems):
GW = buildssic([1, 4; 2, 4; 3, 1], 3, [2, 3, 5],
[3, 4], G, W1, W2, One);
|
One = ugain(1);)
/ \
| / -2w*damp -w \ / w \ |
G = | | |, | |, [ 0 gain ], 0 |
| \ w 0 / \ 0 / |
\ /
|
jet707 (MIMO example, Boeing 707-321
aircraft model)
________
----| gsys |---
u | ---------- +|
----- (_)----> y
| ________ +|
----| hsys |---
--------
|
Inputs
Outputs sys
sys.b := [sys.b , b]
sys.c := [sys.c ]
[ c ]
sys.d := [sys.d | D12 ]
[D21 | D22 ]
|
zeros(1,rows(c))
ones(1,rows(c))
Inputs
sysidx).
The output specified by is connected to the input
specified by .
0
1
Outputs sys: resulting closed loop system.
Method
sysconnect internally permutes selected inputs, outputs as shown
below, closes the loop, and then permutes inputs and outputs back to their
original order
____________________
u_1 ----->| |----> y_1
| sys |
old u_2 | |
u_2* ---->(+)--->| |----->y_2
(in_idx) ^ -------------------| | (out_idx)
| |
-------------------------------
|
Inputs sys is a system data structure
Outputs
returns csys empty if no continuous/continous path exists
Inputs sys = system data structure
Outputs
Inputs
sigidx).
duplicates are made of y(out_idx(ii)) and u(in_idx(ii)).
Outputs
retsys: resulting closed loop system:
duplicated i/o names are appended with a "+" suffix.
Method
sysdup creates copies of selected inputs and outputs as
shown below. u1/y1 is the set of original inputs/outputs, and
u2,y2 is the set of duplicated inputs/outputs in the order specified
in in_idx, out_idx, respectively
____________________
u1 ----->| |----> y1
| asys |
u2 ------>| |----->y2
(in_idx) -------------------| (out_idx)
|
Inputs asys, bsys: system data structures
Outputs
__________________
| ________ |
u1 ----->|--> | asys |--->|----> y1
| -------- |
| ________ |
u2 ----->|--> | bsys |--->|----> y2
| -------- |
------------------
Ksys
|
u ---------- ----------
--->| bsys |---->| asys |--->
---------- ----------
|
Inputs
Indices or signal names of the outputs and inputs to be kept in the returned system; remaining connections are "pruned" off. May select as [] (empty matrix) to specify all outputs/inputs.
retsys = sysprune(Asys,[1:3,4],"u_1");
retsys = sysprune(Asys,list("tx","ty","tz"), 4);
|
Outputs retsys: resulting system
____________________ u1 ------->| |----> y1 (in_idx) | Asys | (out_idx) u2 ------->| |----| y2 (deleted)-------------------- (deleted) |
Inputs
vlen=vector length, list= a subset of [1:vlen],
Outputs
pv: a permutation vector to order elements of [1:vlen] in
list to the end of a vector.
Used internally by sysconnect to permute vector elements to their
desired locations.
Inputs sys: structured system outscale, inscale: constant matrices of appropriate dimension
Outputs sys: resulting open loop system:
----------- ------- -----------
u --->| inscale |--->| sys |--->| outscale |---> y
----------- ------- -----------
|
A warning message is printed if outscale attempts to add continuous system outputs to discrete system outputs; otherwise yd is set appropriately in the returned value of sys.
Method: gsys and hsys are connected in parallel The input vector is connected to both systems; the outputs are subtracted. Returned system names are those of gsys.
+--------+
+--->| gsys |---+
| +--------+ |
| +|
u --+ (_)--> y
| -|
| +--------+ |
+--->| hsys |---+
+--------+
|
Weighting function are needed by the H2/H_infinity design procedure. These function are part of thye augmented plant P (see hinfdemo for an applicattion example).
vl = Gain at low frequencies
vh = Gain at high frequencies
fc = Corner frequency (in Hz, *not* in rad/sec)
____________________ | ________ | u ----->|----> | asys |--->|----> y1 | | -------- | | | ________ | |--->|----> | bsys |--->|----> y2 | -------- | -------------------- ksys
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
a' * x + x * a - x * b * x + c = 0 |
Inputs for identically dimensioned square matrices
"B"):
String option passed to balance prior to ordered Schur decomposition.
Outputs x: solution of the ARE.
Method Laub's Schur method (IEEE Transactions on Automatic Control, 1979) is applied to the appropriate Hamiltonian matrix.
Return the solution, x of the discrete-time algebraic Riccati equation
a' x a - x + a' x b (r + b' x b)^(-1) b' x a + q = 0 |
Inputs
"B"):
String option passed to balance prior to ordered QZ decomposition.
Outputs x solution of DARE.
Method Generalized eigenvalue approach (Van Dooren; SIAM J. Sci. Stat. Comput., Vol 2) applied to the appropriate symplectic pencil.
See also: Ran and Rodman, "Stable Hermitian Solutions of Discrete Algebraic Riccati Equations," Mathematics of Control, Signals and Systems, Vol 5, no 2 (1992) pp 165-194.
-d P/dt = A'P + P A - P B inv(R) B' P + Q P(tf) = Qf |
min \int_{t_0}^{t_f} x' Q x + u' R u dt + x(t_f)' Qf x(t_f)
|
u = - inv(R) B' P(t) x |
is selected so that || Plist{ii} - Plist{ii-1} || < Ptol
for ii=2:length(tvals)
|
x(k+1) = a x(k) + b u(k) |
Inputs
Outputs m (n by n) satisfies
a m a' - m + b*b' = 0 |
Inputs
Outputs x: matrix satisfying appropriate discrete time Lyapunov equation. Options:
a x a' - x + b = 0
a x a' - x + b b' = 0 |
a' x a - x + b' b = 0, |
Method Uses Schur decomposition method as in Kitagawa, An Algorithm for Solving the Matrix Equation , International Journal of Control, Volume 25, Number 5, pages 745--753 (1977).
Column-by-column solution method as suggested in Hammarling, Numerical Solution of the Stable, Non-Negative Definite Lyapunov Equation, IMA Journal of Numerical Analysis, Volume 2, pages 303--323 (1982).
m satisfies .
If a, b, and c are specified, then lyap returns
the solution of the Sylvester equation
a x + x b + c = 0 |
(a, b) are specified, then lyap returns the
solution of the Lyapunov equation
a' x + x a + b = 0 |
lyap returns the solution of either
a' x + x a + b' b = 0 |
a x + x a' + b b' = 0 |
Solves by using the Bartels-Stewart algorithm (1972).
(A - lambda B). |
a and b must be real matrices.
Note qzval is obsolete; use qz instead.
zgepbal
References:
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
dx/dt = a x + b u y = c x + d u |
or a similar discrete-time system.
If the matrices are compatibly dimensioned, then abcddim returns
Otherwise abcddim returns n = m = p = -1.
Note: n = 0 (pure gain block) is returned without warning.
2 n-1 Qs = [ B AB A B ... A B ] |
of a system data structure or the pair (a, b).
Note ctrb forms the controllability matrix.
The numerical properties of is_controllable
are much better for controllability tests.
Reference: Doyle, Glover, Khargonekar, Francis, "State Space Solutions to Standard H2 and Hinf Control Problems", IEEE TAC August 1989
Inputs
Outputs
References: Doyle, Glover, Khargonekar, Francis, "State space solutions to standard H2 and Hinf control problems", IEEE TAC August 1989 Iglesias and Glover, "State-Space approach to discrete-time Hinf control," Int. J. Control, vol 54, #5, 1991 Zhou, Doyle, Glover, "Robust and Optimal Control," Prentice-Hall, 1996
| C |
| CA |
Qb = | CA^2 |
| ... |
| CA^(n-1) |
|
Note: obsv() forms the observability matrix.
The numerical properties of is_observable() are much better for observability tests.
Outputs if omitted, the poles and zeros are plotted on the screen. otherwise, pol, zer are returned as the system poles and zeros. (see sys2zp for a preferable function call)
Inputs
10*eps
Outputs
Method Controllability is determined by applying Arnoldi iteration with complete re-orthogonalization to obtain an orthogonal basis of the Krylov subspace
span ([b,a*b,...,a^{n-1}*b]).
|
krylov if the system
has a single input; otherwise a block Arnoldi iteration is performed
with krylovb.
Returns 1 if the system a or the pair (a,c)is detectable, 0 if not, and -1 if the system has unobservable modes at the imaginary axis (unit circle for discrete-time systems)
See is_stabilizable for detailed description of
arguments and computational method.
[dx/dt] = [A | Bw Bu ][w] [ z ] [Cz | Dzw Dzu ][u] [ y ] [Cy | Dyw Dyu ] |
Inputs
is_dgkf results. Entries:
Note
Note
is_dgkf exits with an error if the system is mixed
discrete/continuous
References
Default: tol = 10*norm(a,'fro')*eps
Returns 1 if the system sys or the pair (a,c) is observable, 0 if not.
See is_controllable for detailed description of arguments
and default values.
This file is part of Octave.
Octave is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version.
Octave is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Octave; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA.
Inputs
dflg != 0
dflg == 0
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Inputs
"ex"
"bi"
2(z-1)
s = -----
T(z+1)
|
ex option can handle mixed systems.)
Note If the 2nd argument is not a string, c2d assumes that
the 2nd argument is t and performs appropriate argument checks.
Outputs dsys discrete time equivalent via zero-order hold, sample each t sec.
converts the system data structure describing
. x = Ac x + Bc u |
x[n+1] = Ad x[n] + Bd u[n] |
Note This function adds the suffix _d
to the names of the new discrete states.
sysgettsam(sys)
Inputs
"log" option (see below)
"log"
If called as d2c (sys, tol), with tol
positive scalar, the "log" option is used. The default value
for tol is 1e-8.
"bi"
sysgettsam).
FIXME: bilinear option exits with an error if sys is not purely discrete
sysgettsam (sys).
Inputs
dmr2d exits with an error if sys is not discrete
sysgettsam(sys) (may be empty); see listidx
sysgettsam(sys) (may be empty)
sysgettsam(sys)
Outputs
The sampling time of sys is updated to ts2.
if cuflg=0 then a set of additional inputs is added to the system with suffixes _d1, ..., _dn to indicate their delay from the starting time k ts2, i.e. u = [u_1; u_1_d1; ..., u_1_dn] where u_1_dk is the input k*ts1 units of time after u_1 is sampled. (ts1 is the original sampling time of the discrete time system and ts2 = (n+1)*ts1)
WARNING Not thoroughly tested yet; especially when cuflg == 0.
impulse
produces a plot or the impulse response data for system sys.
Inputs
Both parameters tstop and n can be omitted and will be computed from the eigenvalues of the A-Matrix.
step
produces a plot or the step response data for system sys.
Inputs
Both parameters tstop and n can be omitted and will be computed from the eigenvalues of the A-Matrix.
When invoked with the output paramter y the plot is not displayed.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Inputs
if sys is continuous, then bode evaluates where is the system transfer function.
if sys is discrete, then bode evaluates G(exp(jwT)), where
Default the default frequency range is selected as follows: (These steps are NOT performed if w is specified)
The names or indices of outputs and inputs to be used in the frequency
response. See sysprune.
Example
bode(sys,[],"y_3",list("u_1","u_4");
|
Notes
bode(sys); |
Failure to include a concluding semicolon will yield some garbage
being printed to the screen (ans = []).
Used internally in __freqresp__ (bode, nyquist)
__freqresp__ to check that input frequency vector w
is valid.
Returns boolean value.
-1
G(s) = (jw I-A) B
|
Compute the frequency response of a system. Inputs (pass as empty to get default values)
Inputs (pass as empty to get default values)
If no output arguments are given, nyquist plots the results to the screen. If atol != 0 and asymptotes are detected then the user is asked interactively if they wish to zoom in (remove asymptotes) Descriptive labels are automatically placed.
Note: if the requested plot is for an MIMO system, a warning message is presented; the returned information is of the magnitude ||G(jw)|| or ||G(exp(jwT))|| only; phase information is not computed.
. x = Ax + Bu y = Cx + Du |
x(k+1) = A x(k) + B u(k) y(k) = C x(k) + D u(k) |
bal = balancing option (see balance); default is "B".
Needs to incorporate mvzero algorithm to isolate finite zeros; use
tzero instead.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
H_infinity design demos for continuous SISO and MIMO systems and a discrete system. The SISO system is difficult to control because it is non minimum phase and unstable. The second design example controls the "jet707" plant, the linearized state space model of a Boeing 707-321 aircraft at v=80m/s (M = 0.26, Ga0 = -3 deg, alpha0 = 4 deg, kappa = 50 deg). Inputs: (1) thrust and (2) elevator angle outputs: (1) airspeed and (2) pitch angle. The discrete system is a stable and second order.
s - 2
G(s) = --------------
(s + 2)(s - 1)
+----+
-------------------->| W1 |---> v1
z | +----+
----|-------------+ || T || => min.
| | vz infty
| +---+ v y +----+
u *--->| G |--->O--*-->| W2 |---> v2
| +---+ | +----+
| |
| +---+ |
-----| K |<-------
+---+
|
w
1 -----------+
| +----+
+---------------------->| W1 |----> z1
w | | +----+
2 ------------------------+
| | |
| v +----+ v +----+
+--*-->o-->| G |-->o--*-->| W2 |---> z2
| +----+ | +----+
| |
^ v
u (from y (to K)
controller
K)
+ + + +
| z | | w |
| 1 | | 1 |
| z | = [ P ] * | w |
| 2 | | 2 |
| y | | u |
+ + + +
|
1
G (s) = --------------
k (s + 2)(s + 1)
|
0.199788z + 0.073498
G(s) = --------------------------
(z - 0.36788)(z - 0.13534)
+----+
-------------------->| W1 |---> v1
z | +----+
----|-------------+ || T || => min.
| | vz infty
| +---+ v +----+
*--->| G |--->O--*-->| W2 |---> v2
| +---+ | +----+
| |
| +---+ |
-----| K |<-------
+---+
|
x[k+1] = A x[k] + B u[k] + G w[k] y[k] = C x[k] + D u[k] + v[k] |
where w, v are zero-mean gaussian noise processes with
respective intensities sigw = cov (w, w) and
sigv = cov (v, v).
If specified, z is cov (w, v). Otherwise
cov (w, v) = 0.
The observer structure is
z[k|k] = z[k|k-1] + L (y[k] - C z[k|k-1] - D u[k]) z[k+1|k] = A z[k|k] + B u[k] |
The following values are returned:
x[k+1] = A x[k] + B u[k] |
to minimize the cost functional
J = Sum (x' Q x + u' R u) |
z omitted or
J = Sum (x' Q x + u' R u + 2 x' Z u) |
z included.
The following values are returned:
x[k+1] = A x[k] + B u[k] + G w[k] y[k] = C x[k] + D u[k] + v[k] |
where w, v are zero-mean gaussian noise processes with
respective intensities Qw = cov (w, w) and
Rv = cov (v, v).
If specified, S is cov (w, v). Otherwise
cov (w, v) = 0.
The observer structure is
x[k+1|k] = A x[k|k-1] + B u[k] + LP (y[k] - C x[k|k-1] - D u[k]) x[k|k] = x[k|k-1] + LF (y[k] - C x[k|k-1] - D u[k]) |
The following values are returned:
P = E [(x - x[n|n-1])(x - x[n|n-1])']
Z = E [(x - x[n|n])(x - x[n|n])']
Discrete time control per Zhou, Doyle, and Glover, ROBUST AND OPTIMAL CONTROL, Prentice-Hall, 1996
Inputs input system is passed as either
Outputs
hinfsyn to compute the H_inf optimal controller.
Inputs
is_dgkf
Do not attempt to use this at home; no argument checking performed.
Inputs input system is passed as either
c2d, d2c)
gmax, min, tol, and tol must all be postive scalars.
hinfsyn to see if gain g satisfies conditions in
Theorem 3 of
Doyle, Glover, Khargonekar, Francis, "State Space Solutions to Standard
H2 and Hinf Control Problems", IEEE TAC August 1989
Warning Do not attempt to use this at home; no argument checking performed.
Inputs as returned by is_dgkf, except for:
hinfsyn
Outputs
xx = ([BB; -C1'*d1dot]/R) * [d1dot'*C1 BB']; Ha = [A 0*A; -C1'*C1 -A'] - xx; |
dx -- = a x + b u dt y = c x + d u |
where w and v are zero-mean gaussian noise processes with respective intensities
sigw = cov (w, w) sigv = cov (v, v) |
The optional argument z is the cross-covariance
cov (w, v). If it is omitted,
cov (w, v) = 0 is assumed.
Observer structure is dz/dt = A z + B u + k (y - C z - D u)
The following values are returned:
dx/dt = A x + B u + G w [w]=N(0,[Sigw 0 ])
y = C x + v [v] ( 0 Sigv ])
|
x(k+1) = A x(k) + B u(k) + G w(k) [w]=N(0,[Sigw 0 ]) y(k) = C x(k) + v(k) [v] ( 0 Sigv ]) |
Inputs
sysidx, listidx)
default: last dim(R) inputs are assumed to be controlled inputs, all others are assumed to be noise inputs.
sys2ss, sys2tf, or sys2zp as
appropriate)
dx -- = A x + B u dt |
to minimize the cost functional
infinity
/
J = | x' Q x + u' R u
/
t=0
|
z omitted or
infinity
/
J = | x' Q x + u' R u + 2 x' Z u
/
t=0
|
z included.
The following values are returned:
Reference Anderson and Moore, OPTIMAL CONTROL: LINEAR QUADRATIC METHODS, Prentice-Hall, 1990, pp. 56-58
Produces a plot for the output of the system, sys.
U is an array that contains the system's inputs. Each row in u corresponds to a different time step. Each column in u corresponds to a different input. T is an array that contains the time index of the system. T should be regularly spaced. If initial conditions are required on the system, the x0 vector should be added to the argument list.
When the lsim function is invoked with output parameters: [y,x] = lsim(sys,u,t,[x0]) a plot is not displayed, however, the data is returned in y = system output and x = system states.
Version: Beta (May-1997): If you have any comments, please let me know. (see the file place.m for my address)
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Inputs axdata nx2 matrix of data [x,y]
Outputs axvec vector of axis limits appropriate for call to axis() function
function prompt([str]) Prompt user to continue str: input string. Default value: "\n ---- Press a key to continue ---" |
[rldata, k] = rlocus(sys[,increment,min_k,max_k])
Displays root locus plot of the specified SISO system.
----- --- --------
--->| + |---|k|---->| SISO |----------->
----- --- -------- |
- ^ |
|_____________________________|
inputs: sys = system data structure
min_k, max_k,increment: minimum, maximum values of k and
the increment used in computing gain values
Outputs: plots the root locus to the screen.
rldata: Data points plotted column 1: real values, column 2: imaginary
values)
k: gains for real axis break points.
|
[yy,idx] = sortcom(xx[,opt]): sort a complex vector xx: complex vector opt: sorting option: "re": real part (default) "mag": by magnitude "im": by imaginary part if opt != "im" then complex conjugate pairs are grouped together, a - jb followed by a + jb. yy: sorted values idx: permutation vector: yy = xx(idx) |
[num,den] = ss2tf(a,b,c,d)
Conversion from tranfer function to state-space.
The state space system
.
x = Ax + Bu
y = Cx + Du
is converted to a transfer function
num(s)
G(s)=-------
den(s)
used internally in system data structure format manipulations
|
Converts a state space representation to a set of poles and zeros. [pol,zer,k] = ss2zp(a,b,c,d) returns the poles and zeros of the state space system (a,b,c,d). K is a gain associated with the zeros. used internally in system data structure format manipulations |
Redheffer star product or upper/lower LFT, respectively.
+-------+
--------->| |--------->
| P |
+--->| |---+ ny
| +-------+ |
+-------------------+
| |
+----------------+ |
| |
| +-------+ |
+--->| |------+ nu
| K |
--------->| |--------->
+-------+
If ny and nu "consume" all inputs and outputs of K then the result
is a lower fractional transformation. If ny and nu "consume" all
inputs and outputs of P then the result is an upper fractional
transformation.
ny and/or nu may be negative (= negative feedback)
|
Conversion from tranfer function to state-space.
The state space system
.
x = Ax + Bu
y = Cx + Du
is obtained from a transfer function
num(s)
G(s)=-------
den(s)
via the function call [a,b,c,d] = tf2ss(num,den).
The vector 'den' must contain only one row, whereas the vector 'num'
may contain as many rows as there are outputs of the system 'y'.
The state space system matrices obtained from this function will be
in controllable canonical form as described in "Modern Control Theory",
[Brogan, 1991].
|
[zer,pol,k] = tf2zp(num,den) returns the zeros and poles of the SISO system defined by num/den. K is a gain associated with the system zeros.
. x = Ax + Bu y = Cx + Du |
[a,b,c,d] = zp2ss(zer,pol,k).
The vectors `zer' and
`pol' may either be row or column vectors. Each zero and pole that
has an imaginary part must have a conjugate in the list.
The number of zeros must not exceed the number of poles.
`k' is zp-form leading coefficient.
[num,den] = zp2tf(zer,pol,k) forms the transfer function
num/den from the vectors of poles and zeros.
| [ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |