Estimate polynomial model using time- or frequency-domain data
sys = polyest(data,[na nb nc nd nf nk])
sys = polyest(data,[na nb nc nd nf nk],Name,Value)
sys = polyest(data,init_sys)
sys = polyest(___, opt)
sys is of the form
A(q), B(q), F(q), C(q) and D(q) are polynomial matrices. u(t) is the input, and nk is the input delay. y(t) is the output and e(t) is the disturbance signal. na ,nb, nc, nd and nf are the orders of the A(q), B(q), C(q), D(q) and F(q) polynomials, respectively.
For time-domain estimation, data is an iddata object containing the input and output signal values.
You can estimate only discrete-time models using time-domain data. For estimating continuous-time models using time-domain data, see tfest.
For frequency-domain estimation, data can be one of the following:
Order of the polynomial A(q).
na is an Ny-by-Ny matrix of nonnegative integers. Ny is the number of outputs, and Nu is the number of inputs.
na must be zero if you are estimating a model using frequency-domain data.
Order of the polynomial B(q) + 1.
nb is an Ny-by-Nu matrix of nonnegative integers. Ny is the number of outputs, and Nu is the number of inputs.
Order of the polynomial C(q).
nc is a column vector of nonnegative integers of length Ny. Ny is the number of outputs.
nc must be zero if you are estimating a model using frequency-domain data.
Order of the polynomial D(q).
nd is a column vector of nonnegative integers of length Ny. Ny is the number of outputs.
nd must be zero if you are estimating a model using frequency-domain data.
Order of the polynomial F(q).
nf is an Ny-by-Nu matrix of nonnegative integers. Ny is the number of outputs, and Nu is the number of inputs.
Input delay in number of samples, expressed as fixed leading zeros of the B polynomial.
nk is an Ny-by-Nu matrix of nonnegative integers.
nk must be zero when estimating a continuous-time model.
opt is an options set, created using polyestOptions, that specifies estimation options including:
Dynamic system that configures the initial parameterization of sys.
If init_sys is an idpoly model, polyest uses the parameters and constraints defined in init_sys as the initial guess for estimating sys.
If init_sys is not an idpoly model, the software first converts init_sys to an identified polynomial. polyest uses the parameters of the resulting model as the initial guess for estimation.
Use the Structure property of init_sys to configure initial guesses and constraints for A(q), B(q), F(q), C(q), and D(q).
To specify an initial guess for, say, the A(q) term of init_sys, set init_sys.Structure.a.Value as the initial guess.
To specify constraints for, say, the B(q) term of init_sys:
You can similarly specify the initial guess and constraints for the other polynomials.
If opt is not specified, and init_sys was created by estimation, then the estimation options from init_sys.Report.OptionsUsed are used.
Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.
Transport delays. ioDelay is a numeric array specifying a separate transport delay for each input/output pair.
For continuous-time systems, specify transport delays in the time unit stored in the TimeUnit property. For discrete-time systems, specify transport delays in integer multiples of the sampling period, Ts.
For a MIMO system with Ny outputs and Nu inputs, set ioDelay to a Ny-by-Nu array. Each entry of this array is a numerical value that represents the transport delay for the corresponding input/output pair. You can also set ioDelay to a scalar value to apply the same delay to all input/output pairs.
Input delay for each input channel, specified as a numeric vector. For continuous-time systems, specify input delays in the time unit stored in the TimeUnit property. For discrete-time systems, specify input delays in integer multiples of the sampling period Ts. For example, InputDelay = 3 means a delay of three sampling periods.
For a system with Nu inputs, set InputDelay to an Nu-by-1 vector. Each entry of this vector is a numerical value that represents the input delay for the corresponding input channel.
You can also set InputDelay to a scalar value to apply the same delay to all channels.
Logical vector specifying integrators in the noise channel.
IntegrateNoise is a logical vector of length Ny, where Ny is the number of outputs.
Setting IntegrateNoise to true for a particular output results in the model:
Where, is the integrator in the noise channel, e(t).
Use IntegrateNoise to create an ARIMAX model.
load iddata1 z1; z1 = iddata(cumsum(z1.y),cumsum(z1.u),z1.Ts,'InterSample','foh'); sys = polyest(z1, [2 2 2 0 0 1],'IntegrateNoise',true);
Estimated polynomial model.
sys is an idpoly model.
If data.Ts is zero, sys is a continuous-time model representing:
Y(s), U(s) and E(s) are the Laplace transforms of the time-domain signals y(t), u(t) and e(t), respectively.
Estimate a polynomial model with redundant parameterization. That is, all the polynomials (A, B, C, D, and F) are active.
Obtain input/output data.
load iddata2 z2
Estimate the model.
na = 2; nb = 2; nc = 3; nd = 3; nf = 2; nk = 1; sys = polyest(z2,[na nb nc nd nf nk]);
Estimate a regularized polynomial model by converting a regularized ARX model.
load regularizationExampleData.mat m0simdata;
Estimate an unregularized polynomial model of order 20.
m1 = polyest(m0simdata(1:150), [0 20 20 20 20 1]);
Estimate a regularized polynomial model by determining Lambda value by trial and error.
opt = polyestOptions; opt.Regularization.Lambda = 1; m2 = polyest(m0simdata(1:150),[0 20 20 20 20 1], opt);
Obtain a lower-order polynomial model by converting a regularized ARX model followed by order reduction.
opt1 = arxOptions; [L,R] = arxRegul(m0simdata(1:150), [30 30 1]); opt1.Regularization.Lambda = L; opt1.Regularization.R = R; m0 = arx(m0simdata(1:150),[30 30 1],opt1); mr = idpoly(balred(idss(m0),7));
Compare the model outputs against data.
compare(m0simdata(150:end), m1, m2, mr, compareOptions('InitialCondition','z'));
Obtain input/output data.
load iddata1 z1; data = iddata(cumsum(z1.y),cumsum(z1.u),z1.Ts,'InterSample','foh');
Identify an ARIMAX model. Set the inactive polynomials, F and D, to zero.
na = 2; nb = 2; nc = 2; nd = 0; nf = 0; nk = 1; sys = polyest(data,[na nb nc nd nf nk],'IntegrateNoise',true);
Estimate a multi-output ARMAX model for a multi-input, multi-output data set.
Obtain input/output data.
load iddata1 z1 load iddata2 z2 data = [z1, z2(1:300)];
data is a data set with 2 inputs and 2 outputs. The first input affects only the first output. Similarly, the second input affects only the second output.
Estimate the model.
na = [2 2; 2 2]; nb = [2 2; 3 4]; nk = [1 1; 0 0]; nc = [2;2]; nd = [0;0]; nf = [0 0; 0 0]; sys = polyest(data,[na nb nc nd nf nk])
In the estimated ARMAX model, the cross terms, modeling the effect of the first input on the second output and vice versa, are negligible. If you assigned higher orders to those dynamics, their estimation would show a high level of uncertainty.
The F and D polynomials of sys are inactive.
Analyze the results.
h = bodeplot(model); showConfidence(h,3)
The responses from the cross terms show larger uncertainty.
To estimate a polynomial model using time-series data, use ar.
Use polyest to estimate a polynomial of arbitrary structure. If the structure of the estimated polynomial model is known, that is, you know which polynomials will be active, then use the appropriate dedicated estimating function. For examples, for an ARX model, use arx. Other polynomial model estimating functions include, oe, armax, and bj.
For example, you can estimate an Output-Error (OE) model by specifying na, nc and nd as zero.