# Control theory

## Block diagram manipulations

 bddemo [octave/scripts/control/base/bddemo.m]
Octave Controls toolbox demo: Block Diagram Manipulations demo

 buildssic [octave/scripts/control/system/buildssic.m]
Form an arbitrary complex (open or closed loop) system in state-space form from several systems.

 feedback [octave-forge/main/control/feedback.m]
Filter the output of sys1 through sys2 and subtract it from the input.

 jet707 [octave/scripts/control/system/jet707.m]
Creates linearized state space model of a Boeing 707-321 aircraft at v=80m/s.

 ord2 [octave/scripts/control/system/ord2.m]
Creates a continuous 2nd order system with parameters: *Inputs*

 parallel [octave/scripts/control/system/parallel.m]
Forms the parallel connection of two systems.

 starp [octave/scripts/control/system/starp.m]
Redheffer star product or upper/lower LFT, respectively.

returns SYS = GSYS + HSYS.

 sysappend [octave/scripts/control/system/sysappend.m]
appends new inputs and/or outputs to a system

 sysconnect [octave/scripts/control/system/sysconnect.m]
Close the loop from specified outputs to respective specified inputs

 syscont [octave/scripts/control/system/syscont.m]
Extract the purely continuous subsystem of an input system.

 sysdisc [octave/scripts/control/system/sysdisc.m]
*Inputs* SYS = system data structure

 sysdup [octave/scripts/control/system/sysdup.m]
Duplicate specified input/output connections of a system

 sysgroup [octave/scripts/control/system/sysgroup.m]
Combines two systems into a single system

 sysmin [octave/scripts/control/system/sysmin.m]
return a minimal (or reduced order) system inputs: sys: system data structure flg: 0 [default] return minimal system; state names lost : 1 return system with physical states removed that are either uncontrollable or unobservable (cannot reduce further without discarding physical meaning of states) outputs: retsys: returned system nc: number of controllable states in the returned system no: number of observable states in the returned system cflg: is_controllable(retsys) oflg: is_observable(retsys)

 sysmult [octave/scripts/control/system/sysmult.m]
Compute sys = Asys*Bsys (series connection):

 sysprune [octave/scripts/control/system/sysprune.m]
Extract specified inputs/outputs from a system

 sysreorder [octave/scripts/control/system/sysreorder.m]
*Inputs* VLEN=vector length, LIST= a subset of `[1:vlen]',

 sysscale [octave/scripts/control/system/sysscale.m]
scale inputs/outputs of a system.

 syssub [octave/scripts/control/system/syssub.m]
Return sys = Gsys - Hsys.

 ugain [octave/scripts/control/system/ugain.m]
Creates a system with unity gain, no states.

 wgt1o [octave/scripts/control/hinf/wgt1o.m]
State space description of a first order weighting function.

## Compatibility

 append(sys)
use ``` sysappend```

 connect [octave-forge/main/parallel/connect.cc]
Connect hosts and return sockets.

 filt
use ``` tf2sys```

 isct
use !`is_digital`

 isdt
use ``` is_digital```

 issiso
use ``` is_siso```

 kalman
use ``` lqe```

 kalmd
use ``` dlqe``` or ``` dkalman```

 lft
use ``` starp```

 norm(sys)
use ``` h2norm```, ``` hinfnorm``` or ``` zgrownorm```

 ss
use ``` ss2sys```

 ssdata
use ``` sys2ss```

 tf
use ``` tf2sys```

 tfdata
use ``` sys2tf```

 zero
use ``` tzero``` or ``` tzero2```

 zpk
use ``` zp2sys```

 zpkdata
use ``` sys2zp```

## Controller design

 dgkfdemo [octave/scripts/control/hinf/dgkfdemo.m]
Octave Controls toolbox demo: H2/Hinfinity options demos

 dhinfdemo [octave/scripts/control/hinf/dhinfdemo.m]
Demonstrate the functions available for designining a discrete H_infinity controller.

 dkalman [octave/scripts/control/base/dkalman.m]
Construct the linear quadratic estimator (Kalman predictor) for the discrete time system

 dlqe [octave/scripts/control/base/dlqe.m]
Construct the linear quadratic estimator (Kalman filter) for the discrete time system

 dlqr [octave/scripts/control/base/dlqr.m]
Construct the linear quadratic regulator for the discrete time system

 h2syn [octave/scripts/control/hinf/h2syn.m]
Design H2 optimal controller per procedure in Doyle, Glover, Khargonekar, Francis, "State Space Solutions to Standard H2 and Hinf Control Problems", IEEE TAC August 1989

 hinfdemo [octave/scripts/control/hinf/hinfdemo.m]
H_infinity design demos for continuous SISO and MIMO systems and a discrete system.

 hinfsyn [octave/scripts/control/hinf/hinfsyn.m]
*Inputs* input system is passed as either

Called by `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

Forms

 hinf_ctr [octave/scripts/control/hinf/hinf_ctr.m]
Called by `hinfsyn' to compute the H_inf optimal controller.

 lqe [octave/scripts/control/base/lqe.m]
Construct the linear quadratic estimator (Kalman filter) for the continuous time system

 lqg [octave/scripts/control/base/lqg.m]
Design a linear-quadratic-gaussian optimal controller for the system

 lqr [octave/scripts/control/base/lqr.m]
construct the linear quadratic regulator for the continuous time system

 lsim [octave/scripts/control/base/lsim.m]
Produce output for a linear simulation of a system

 place [octave/scripts/control/base/place.m]
Computes the matrix K such that if the state is feedback with gain K, then the eigenvalues of the closed loop system (i.e.

## Data structure access

 minfo [octave/scripts/control/obsolete/minfo.m]
Determines the type of system matrix.

 syschtsam [octave/scripts/control/system/syschtsam.m]
This function changes the sampling time (tsam) of the system.

return the number of states, inputs, and/or outputs in the system SYS.

Get signal names from a system

 sysgettsam [octave/scripts/control/system/sysgettsam.m]
Return the sampling time of the system SYS.

 sysgettype [octave/scripts/control/system/sysgettype.m]
return the initial system type of the system

change the names of selected inputs, outputs and states.

 sysupdate [octave/scripts/control/system/sysupdate.m]
Update the internal representation of a system.

## Frequency domain analysis

 bode [octave/scripts/control/base/bode.m]
If no output arguments are given: produce Bode plots of a system; otherwise, compute the frequency response of a system data structure

Get default range of frequencies based on cutoff frequencies of system poles and zeros.

 frdemo [octave/scripts/control/base/frdemo.m]
Octave Controls toolbox demo: Frequency Response demo

 freqchkw [octave/scripts/control/base/freqchkw.m]
Used by `__freqresp__' to check that input frequency vector W is valid.

 ltifr [octave/scripts/control/base/ltifr.m]
Linear time invariant frequency response of single input systems *Inputs*

 nichols [octave/scripts/control/base/nichols.m]
Produce Nichols plot of a system.

 nyquist [octave/scripts/control/base/nyquist.m]
Produce Nyquist plots of a system; if no output arguments are given, Nyquist plot is printed to the screen.

 rlocus [octave/scripts/control/base/rlocus.m]
[rldata, k] = rlocus(sys[,increment,min_k,max_k]) Displays root locus plot of the specified SISO system.

 tzero [octave/scripts/control/base/tzero.m]
Compute transmission zeros of a continuous

 tzero2 [octave/scripts/control/base/tzero2.m]
Compute the transmission zeros of a, b, c, d.

## Internal

Used internally in `abcddim'.

used internally by bode, nyquist; compute system frequency response.

Frequency response function - used internally by `bode', `nyquist'.

Prints an enumerated list of strings.

Impulse or step response for a linear system.

used internally in syschnames item olist: index list old_names: original list names inames: new names listname: name of index list

Used internally in syscont and sysdisc.

return default input or output names given N, STR, M.

return default state names given N, NZ

Locate and mark duplicate names inputs: names: list of signal names kind: kind of signal name (used for diagnostic message purposes only) outputs: returns names with unique suffixes added; diagnostic warning message is printed to inform the user of the new signal name

used internally in tf2sys.

 __zgpbal__ [octave/scripts/control/util/__zgpbal__.m]
used internally in `tzero'; minimal argument checking performed

Used internally in `zp2ss' Extract 2 values from RVALS (if possible) and construct a polynomial with those roots.

## Miscellaneous

 axis2dlim [octave/scripts/control/util/axis2dlim.m]
determine axis limits for 2-d data(column vectors); leaves a 10% margin around the plots.

 listidx [octave/scripts/control/system/listidx.m]
Return indices of string entries in LISTVAR that match strings in STRLIST.

 packedform [octave/scripts/control/system/packedform.m]
no description

 prompt [octave/scripts/control/util/prompt.m]
function prompt([str])

 run_cmd [octave/scripts/control/util/run_cmd.m]
short script used in demos

 sortcom [octave/scripts/control/util/sortcom.m]
[yy,idx] = sortcom(xx[,opt]): sort a complex vector

 strappend [octave/scripts/control/util/strappend.m]
Append string SUFFIX to each string in the list STRLIST.

 swap [octave/scripts/control/util/swap.m]
[a1,b1] = swap(a,b)

 sysidx [octave/scripts/control/system/sysidx.m]
Return indices of signals with specified signal names inputs given a system data structure SYS, a signal type to be selected SIGTYPE (`"in"', `"out"', `"st"'), and a list of desired signal names SIGNAMELIST.

## Numerical functions

 are [octave/scripts/control/base/are.m]
Solve the algebraic Riccati equation

 dare [octave/scripts/control/base/dare.m]
Return the solution, X of the discrete-time algebraic Riccati equation

 dgram [octave/scripts/control/base/dgram.m]
Return controllability grammian of discrete time system

 dlyap [octave/scripts/control/base/dlyap.m]
Solve the discrete-time Lyapunov equation

 dre [octave/scripts/control/base/dre.m]
Solve the differential Riccati equation

 gram [octave/scripts/control/base/gram.m]
Return controllability grammian M of the continuous time system dx/dt = a x + b u.

 lyap [octave/scripts/control/base/lyap.m]
Solve the Lyapunov (or Sylvester) equation via the Bartels-Stewart algorithm (Communications of the ACM, 1972).

 pinv [octave/src/DLD-FUNCTIONS/pinv.cc]
Return the pseudoinverse of X.

 zgfmul [octave/scripts/control/util/zgfmul.m]
Compute product of zgep incidence matrix F with vector X.

 zgfslv [octave/scripts/control/util/zgfslv.m]
Solve system of equations for dense zgep problem.

 zginit [octave/scripts/control/util/zginit.m]
Construct right hand side vector zz for the zero-computation generalized eigenvalue problem balancing procedure.

 zgreduce [octave/scripts/control/util/zgreduce.m]
Implementation of procedure REDUCE in (Emami-Naeini and Van Dooren, Automatica, # 1982).

 zgrownorm [octave/scripts/control/util/zgrownorm.m]
Return NONZ = number of rows of MAT whose two norm exceeds MEPS, and ZER = number of rows of mat whose two norm is less than MEPS.

 zgscal [octave/scripts/control/util/zgscal.m]
Generalized conjugate gradient iteration to solve zero-computation generalized eigenvalue problem balancing equation fx=z; called by `zgepbal'

 zgsgiv [octave/scripts/control/util/zgsgiv.m]
Apply givens rotation c,s to row vectors A, B.

 zgshsr [octave/scripts/control/util/zgshsr.m]
apply householder vector based on e^(m) to (column vector) y.

## OCST demos

 analdemo [octave/scripts/control/base/analdemo.m]
Octave Controls toolbox demo: State Space analysis demo

 bddemo [octave/scripts/control/base/bddemo.m]
Octave Controls toolbox demo: Block Diagram Manipulations demo

Controls toolbox demo.

Octave Control Systems Toolbox demo/tutorial program.

 dgkfdemo [octave/scripts/control/hinf/dgkfdemo.m]
Octave Controls toolbox demo: H2/Hinfinity options demos

 dhinfdemo [octave/scripts/control/hinf/dhinfdemo.m]
Demonstrate the functions available for designining a discrete H_infinity controller.

 frdemo [octave/scripts/control/base/frdemo.m]
Octave Controls toolbox demo: Frequency Response demo

 hinfdemo [octave/scripts/control/hinf/hinfdemo.m]
H_infinity design demos for continuous SISO and MIMO systems and a discrete system.

 jet707 [octave/scripts/control/system/jet707.m]
Creates linearized state space model of a Boeing 707-321 aircraft at v=80m/s.

 moddemo [octave/scripts/control/system/moddemo.m]
Octave Controls toolbox demo: Model Manipulations demo

 rldemo [octave/scripts/control/base/rldemo.m]
Octave Controls toolbox demo: Root Locus demo

 sysrepdemo [octave/scripts/control/system/sysrepdemo.m]
Tutorial for the use of the system data structure functions.

## Obsolete

 dezero [octave/scripts/control/obsolete/dezero.m]
Remove trailing blank entries and all zero entries from the string s.

 dlqg [octave/scripts/control/obsolete/dlqg.m]
O B S O L E T E * * * D O N O T U S E!

 minfo [octave/scripts/control/obsolete/minfo.m]
Determines the type of system matrix.

 packsys [octave/scripts/control/obsolete/packsys.m]
O B S O L E T E: use ss2sys instead.

 qzval [octave/scripts/control/obsolete/qzval.m]
Compute generalized eigenvalues of the matrix pencil (A - lambda B).

 rotg [octave/scripts/control/obsolete/rotg.m]
givens rotation calculation

 series [octave/scripts/control/obsolete/series.m]
Forms the series connection of two systems.

 swapcols [octave/scripts/control/obsolete/swapcols.m]
function B = swapcols(A)

 swaprows [octave/scripts/control/obsolete/swaprows.m]
function B = swaprows(A)

 syschnames [octave/scripts/control/obsolete/syschnames.m]
Superseded by `syssetsignals'

 unpacksys [octave/scripts/control/obsolete/unpacksys.m]
Obsolete.

## System display functions

 polyout [octave/scripts/polynomial/polyout.m]
Write formatted polynomial

 sysout [octave/scripts/control/system/sysout.m]
print out a system data structure in desired format

 tfout [octave/scripts/control/system/tfout.m]
Print formatted transfer function n(s)/d(s) to the screen.

 zpout [octave/scripts/control/system/zpout.m]
print formatted zero-pole form to the screen.

## System interface functions

 fir2sys [octave/scripts/control/system/fir2sys.m]
construct a system data structure from FIR description

 ss2sys [octave/scripts/control/system/ss2sys.m]
Create system structure from state-space data.

 ss2tf [octave/scripts/control/system/ss2tf.m]
[num,den] = ss2tf(a,b,c,d) Conversion from tranfer function to state-space.

 ss2zp [octave/scripts/control/system/ss2zp.m]
Converts a state space representation to a set of poles and zeros.

 sys2fir [octave/scripts/control/system/sys2fir.m]
Extract FIR data from system data structure; see fir2sys for parameter descriptions.

 sys2ss [octave/scripts/control/system/sys2ss.m]
Extract state space representation from system data structure.

 sys2tf [octave/scripts/control/system/sys2tf.m]
Extract transfer function data from a system data structure

 sys2zp [octave/scripts/control/system/sys2zp.m]
Extract zero/pole/leading coefficient information from a system data structure

 sysrepdemo [octave/scripts/control/system/sysrepdemo.m]
Tutorial for the use of the system data structure functions.

 tf2ss [octave/scripts/control/system/tf2ss.m]
Conversion from tranfer function to state-space.

 tf2sys [octave/scripts/control/system/tf2sys.m]
build system data structure from transfer function format data

 tf2zp [octave/scripts/control/system/tf2zp.m]
Converts transfer functions to poles / zeros.

 zp2ss [octave/scripts/control/system/zp2ss.m]
Conversion from zero / pole to state space.

 zp2sys [octave/scripts/control/system/zp2sys.m]
Create system data structure from zero-pole data.

 zp2tf [octave/scripts/control/system/zp2tf.m]
Converts zeros / poles to a transfer function.

## System properties

 abcddim [octave/scripts/control/system/abcddim.m]
Check for compatibility of the dimensions of the matrices defining the linear system [A, B, C, D] corresponding to

 analdemo [octave/scripts/control/base/analdemo.m]
Octave Controls toolbox demo: State Space analysis demo

 ctrb [octave/scripts/control/base/ctrb.m]
Build controllability matrix

 h2norm [octave/scripts/control/hinf/h2norm.m]
Computes the H2 norm of a system data structure (continuous time only)

 hinfnorm [octave/scripts/control/hinf/hinfnorm.m]
Computes the H infinity norm of a system data structure.

 is_abcd [octave/scripts/control/system/is_abcd.m]
Returns RETVAL = 1 if the dimensions of A, B, C, D are compatible, otherwise RETVAL = 0 with an appropriate diagnostic message printed to the screen.

Logical check for system controllability.

Test for detactability (observability of unstable modes) of (A,C).

 is_dgkf [octave/scripts/control/hinf/is_dgkf.m]
Determine whether a continuous time state space system meets assumptions of DGKF algorithm.

 is_digital [octave/scripts/control/system/is_digital.m]
Return nonzero if system is digital; inputs: sys: system data structure eflg: 0 [default] exit with an error if system is mixed (continuous and discrete components) : 1 print a warning if system is mixed (continuous and discrete) : 2 silent operation outputs: DIGITAL: 0: system is purely continuous : 1: system is purely discrete : -1: system is mixed continuous and discrete Exits with an error of sys is a mixed (continuous and discrete) system

Logical check for system observability.

 is_sample [octave/scripts/control/system/is_sample.m]
Return true if TS is a valid sampling time (real,scalar, > 0)

Return true if MYLIST is a list of individual strings.

 is_siso [octave/scripts/control/system/is_siso.m]
return nonzero if the system data structure SYS is single-input, single-output.

Logical check for system stabilizability (i.e., all unstable modes are controllable).

 is_stable [octave/scripts/control/system/is_stable.m]
Returns 1 if the matrix A or the system SYS is stable, or 0 if not.

 obsv [octave/scripts/control/base/obsv.m]
Build observability matrix

 pzmap [octave/scripts/control/base/pzmap.m]
Plots the zeros and poles of a system in the complex plane.

## Time domain analysis

 c2d [octave/scripts/control/system/c2d.m]
*Inputs*

 d2c [octave/scripts/control/system/d2c.m]
Convert discrete (sub)system to a purely continuous system.

 damp [octave/scripts/control/base/damp.m]
Displays eigenvalues, natural frequencies and damping ratios of the eigenvalues of a matrix P or the A-matrix of a system P, respectively.

 dcgain [octave/scripts/control/base/dcgain.m]
Returns dc-gain matrix.

 dmr2d [octave/scripts/control/system/dmr2d.m]
convert a multirate digital system to a single rate digital system states specified by IDX, SPREFIX are sampled at TS2, all others are assumed sampled at TS1 = `sysgettsam (SYS)'.

 impulse [octave/scripts/control/base/impulse.m]
Impulse response for a linear system.

 step [octave/scripts/control/base/step.m]
Step response for a linear system.

## System Indentification

 idplot [octave-forge/main/ident/idplot.m]
Plot inputs and ouputs defined by the system z.

 idsim [octave-forge/main/ident/idsim.m]
Simulate the effects of the MISO system defined by th.

 mktheta [octave-forge/main/ident/mktheta.m]
Create a theta structure from the IIR system Ay = Bx.

 poly2th [octave-forge/main/ident/poly2th.m]
Represent the generalized Multi-Input, Single-Output (MISO) system