Main Content

setPolyFormat

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

Description

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

example

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

Load estimation data.

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

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

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;

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

Version History

Introduced in R2010a