# setPolyFormat

Specify format for B and F polynomials of multi-input polynomial model

## Syntax

• ``modelOut = setPolyFormat(modelIn,'double')``
example
• ``modelOut = setPolyFormat(modelIn,'cell')``

## Description

example

````modelOut = setPolyFormat(modelIn,'double')` converts the `b` and `f` polynomials of a multi-input polynomial model, `modelIn`, to double matrices.By default, the `b` and `f` polynomials of an `idpoly` model are cell arrays. For MATLAB® scripts written before R2012a, convert the cell arrays to double matrices for backward compatibility using this syntax. For example:model = arx(data,[3 2 2 1 1]); model = setPolyFormat(model,'double'); ```
````modelOut = setPolyFormat(modelIn,'cell')` converts the `b` and `f` polynomials of `modelIn` to cell arrays.MATLAB data files saved before R2012a store `idpoly` models with their `b` and `f` polynomials represented as double matrices. If these models were previously set to operate in backward-compatibility mode, they are not converted to use cell arrays when loaded. Convert these models to use cell arrays using this syntax. For example:load polyData.mat model; model = setPolyFormat(model,'cell'); ```

## Examples

collapse all

### Convert B and F Polynomials of a Multi-Input ARX Model to Double Matrices

```load iddata8; ```

Estimate the model.

```m1 = arx(z8,[3 [2 2 1] [1 1 1]]); ```

Convert the `b` and `f` polynomials to use double matrices.

```m2 = setPolyFormat(m1,'double'); ```

Extract pole and zero information from the model using matrix syntax.

```Poles1 = roots(m2.f(1,:)); Zeros1 = roots(m2.b(1,:)); ```

## Input Arguments

collapse all

### `modelIn` — Polynomial model`idpoly` object

Polynomial model, specified as an `idpoly` object. The `b` and `f` polynomials of `modelIn` are either:

• Cell arrays with Nu elements, where Nu is the number of model inputs, with each element containing a double vector. This configuration is the default.

• Double matrices with Nu rows. This configuration applies to backward-compatible `idpoly` models stored in MATLAB data files before R2012a.

 Note:   `setPolyFormat` only supports multi-input, single-output models. Specifying `modelIn` as a:Multi-output model generates an error.Single-input, single-output model has no effect. The `b` and `f` polynomials remain as double vectors.

## Output Arguments

collapse all

### `modelOut` — Polynomial model`idpoly` object

Polynomial model, returned as an `idpoly` object.

To access the `b` and `f` polynomials of `modelOut`, use:

• Matrix syntax after using `modelOut = setPolyFormat(modelIn,'double')`. For example:

`modelOut.b(1,:);`
• Cell array syntax after using ```modelOut = setPolyFormat(modelIn,'cell')```. For example:

`modelOut.b{1};`

After using `modelOut = setPolyFormat(modelIn,'cell')`, you can resave the converted model in cell array format. For example:

`save polyNew.mat modelOut;`

expand all

### Tips

• To verify the current format of the `b` and `f` polynomials for a given `idpoly` model, enter:

`class(model.b)`

If the model uses double matrices, the displayed result is:

```ans = double```

Otherwise, for cell arrays, the result is:

```ans = cell```