### 29.10 Miscellaneous Functions (Not yet properly filed/documented)

— Function File: axis2dlim (axdata)

> Determine axis limits for 2-D data (column vectors); leaves a 10% margin around the plots. Inserts margins of +/- 0.1 if data is one-dimensional (or a single point).

> Input

> axdata
>   n by 2 matrix of data [x, y].

> Output

> axvec
>   Vector of axis limits appropriate for call to `axis` function.

— Function File: moddemo (inputs)

> Octave Control toolbox demo: Model Manipulations demo.

— Function File: prompt (str)

> Prompt user to continue

> Input

> str
>   Input string. Its default value is:

>                      \n ---- Press a key to  continue ---

— Function File: rldemo (inputs)

> Octave Control toolbox demo: Root Locus demo.

— Function File: [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
>   Minimum value of k
> max_k
>   Maximum value of k
> increment
>   The increment used in computing gain values

> Outputs

> Plots the root locus to the screen.

> rldata
>   Data points plotted: in column 1 real values, in column 2 the imaginary values.
> k
>   Gains for real axis break points.

— Function File: [yy, idx] = sortcom (xx[, opt])

> Sort a complex vector.

> Inputs

> xx
>   Complex vector
> opt
>   sorting option:
>   `"re"`
>     Real part (default);
>   `"mag"`
>     By magnitude;
>   `"im"`
>     By imaginary part.
>   if opt is not chosen as `"im"`, then complex conjugate pairs are grouped together, a - jb followed by a + jb.

> Outputs

> yy
>   Sorted values
> idx
>   Permutation vector: `yy = xx(idx)`

— Function File: [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.

— Function File: [pol, zer, k] = ss2zp (a, b, c, d)

> Converts a state space representation to a set of poles and zeros; k is a gain associated with the zeros.

> Used internally in system data structure format manipulations.

— Function File: starp (P, K, ny, nu)

> 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 (i.e. negative feedback).

— Function File: [a, b, c, d] = tf2ss (num, den)

> 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)

> The vector den must contain only one row, whereas the vector num may contain as many rows as there are outputs y of the system. The state space system matrices obtained from this function will be in controllable canonical form as described in Modern Control Theory, (Brogan, 1991).

— Function File: [zer, pol, k] = tf2zp (num, den)

> Converts transfer functions to poles-and-zero representations.

> Returns the zeros and poles of the SISO system defined by num/den. k is a gain associated with the system zeros.

— Function File: [a, b, c, d] = zp2ss (zer, pol, k)

> Conversion from zero / pole to state space.

> Inputs

> zer
> pol
>   Vectors of (possibly) complex poles and zeros of a transfer function. Complex values must come in conjugate pairs (i.e., x+jy in zer means that x-jy is also in zer). The number of zeros must not exceed the number of poles.
> k
>   Real scalar (leading coefficient).

> Outputs

> a
> b
> c
> d
>   The state space system, in the form:

>                           .
>                           x = Ax + Bu
>                           y = Cx + Du

— Function File: [num, den] = zp2tf (zer, pol, k)

> Converts zeros / poles to a transfer function.

> Inputs

> zer
> pol
>   Vectors of (possibly complex) poles and zeros of a transfer function. Complex values must appear in conjugate pairs.
> k
>   Real scalar (leading coefficient).