# polydata

Access polynomial coefficients and uncertainties of identified model

## Syntax

```[A,B,C,D,F] = polydata(sys) [A,B,C,D,F,dA,dB,dC,dD,dF] = polydata(sys) [___] = polydata(sys,J1,...,JN) [___] = polydata(___,'cell') ```

## Description

`[A,B,C,D,F] = polydata(sys)` returns the coefficients of the polynomials `A`, `B`, `C`, `D`, and `F` that describe the identified model `sys`. The polynomials describe the `idpoly` representation of `sys` as follows.

• For discrete-time `sys`:

`$A\left({q}^{-1}\right)y\left(t\right)=\frac{B\left({q}^{-1}\right)}{F\left({q}^{-1}\right)}u\left(t-nk\right)+\frac{C\left({q}^{-1}\right)}{D\left({q}^{-1}\right)}e\left(t\right).$`

u(t) are the inputs to `sys`. y(t) are the outputs. e(t) is a white noise disturbance.

• For continuous-time `sys`:

`$A\left(s\right)Y\left(s\right)=\frac{B\left(s\right)}{F\left(s\right)}U\left(s\right){e}^{-\tau s}+\frac{C\left(s\right)}{D\left(s\right)}E\left(s\right).$`

U(s) are the Laplace transformed inputs to `sys`. Y(s) are the Laplace transformed outputs. E(s) is the Laplace transform of a white noise disturbance.

If `sys` is an identified model that is not an `idpoly` model, `polydata` converts `sys` to `idpoly` form to extract the polynomial coefficients.

```[A,B,C,D,F,dA,dB,dC,dD,dF] = polydata(sys)``` also returns the uncertainties `dA`, `dB`, `dC`, `dD`, and `dF` of each of the corresponding polynomial coefficients of `sys`.

`[___] = polydata(sys,J1,...,JN)` returns the polynomial coefficients for the `J1,...,JN` entry in the array `sys` of identified models.

`[___] = polydata(___,'cell')` returns all polynomials as cell arrays of double vectors, regardless of the input and output dimensions of `sys`.

## Input Arguments

 `sys` Identified model or array of identified models. `sys` can be continuous-time or discrete-time. `sys` can be SISO or MIMO. `J1,...,JN` Indices selecting a particular model from an N-dimensional array `sys` of identified models.

## Output Arguments

 `A,B,C,D,F` Polynomial coefficients of the `idpoly` representation of `sys`. If `sys` is a SISO model, each of `A`, `B`, `C`, `D`, and `F` is a row vector. The length of each row vector is the order of the corresponding polynomial. For discrete-time `sys`, the coefficients are ordered in ascending powers of q–1. For example, `B = [1 -4 9]` means that B(q–1) = 1 – 4q–1 + 9q–2.For continuous-time `sys`, the coefficients are ordered in descending powers of s. For example, ```B = [1 -4 9]``` means that B(s) = s2 – 4s + 9.If `sys` is a MIMO model, each of `A`, `B`, `C`, `D`, and `F` is a cell array. The dimensions of the cell arrays are determined by the input and output dimensions of `sys` as follows:`A` — Ny-by-Ny cell array`B`, `F` — Ny-by-Nu cell array`C`, `D` — Ny-by-1 cell arrayNy is the number of outputs of `sys`, and Nu is the number of inputs. Each entry in a cell array is a row vector that contains the coefficients of the corresponding polynomial. The polynomial coefficients are ordered the same way as the SISO case. `dA,dB,dC,dD,dF` Uncertainties in the estimated polynomial coefficients of `sys`. `dA`, `dB`, `dC`, `dD`, and `dF` are row vectors or cell arrays whose dimensions exactly match the corresponding `A`, `B`, `C`, `D`, and `F` outputs. Each entry in `dA`, `dB`, `dC`, `dD`, and `dF` gives the standard deviation of the corresponding estimated coefficient. For example, `dA{1,1}(2)` gives the standard deviation of the estimated coefficient returned at `A{1,1}(2)`.

## Examples

collapse all

Load system data and estimate a 2-input, 2-output model.

```load iddata1 z1 load iddata2 z2 data = [z1 z2(1:300)]; nk = [1 1; 1 0]; na = [2 2; 1 3]; nb = [2 3; 1 4]; nc = [2;3]; nd = [1;2]; nf = [2 2;2 1]; sys = polyest(data,[na nb nc nd nf nk]);```

The data loaded into `z1` and `z2` is discrete-time `iddata` with a sample time of 0.1 s. Therefore, `sys` is a two-input, two-output discrete-time `idpoly` model of the form:

`$A\left({q}^{-1}\right)y\left(t\right)=\frac{B\left({q}^{-1}\right)}{F\left({q}^{-1}\right)}u\left(t-nk\right)+\frac{C\left({q}^{-1}\right)}{D\left({q}^{-1}\right)}e\left(t\right)$`

The inputs to `polyest` set the order of each polynomial in `sys`.

Access the estimated polynomial coefficients of `sys` and the uncertainties in those coefficients.

`[A,B,C,D,F,dA,dB,dC,dD,dF] = polydata(sys);`

The outputs `A`, `B`, `C`, `D`, and `F` are cell arrays of coefficient vectors. The dimensions of the cell arrays are determined by the input and output dimensions of `sys`. For example, `A` is a 2-by-2 cell array because `sys` has two inputs and two outputs. Each entry in `A` is a row vector containing identified polynomial coefficients. For example, examine the second diagonal entry in `A`.

`A{2,2}`
```ans = 1×4 1.0000 -0.8825 -0.2030 0.4364 ```

For discrete-time `sys`, the coefficients are arranged in order of increasing powers of ${q}^{-1}$. Therefore, `A{2,2}` corresponds to the polynomial $1-0.8682{q}^{-1}-0.2244{q}^{-2}+0.4467{q}^{-3}.$

The dimensions of `dA` match those of `A`. Each entry in `dA` gives the standard deviation of the corresponding estimated polynomial coefficient in `A`. For example, examine the uncertainties of the second diagonal entry in `A`.

`dA{2,2}`
```ans = 1×4 0 0.2849 0.4269 0.2056 ```

The lead coefficient of `A{2,2}` is fixed at `1`, and therefore has no uncertainty. The remaining entries in `dA{2,2}` are the uncertainties in the ${q}^{-1}$, ${q}^{-2}$, and ${q}^{-3}$ coefficients, respectively.