This example shows how to estimate a transfer function model when the structure of the expected model is known and apply constraints to the numerator and denominator coefficients.
Load time-domain data.
loadiddata1z1; z1.y = cumsum(z1.y);
cumsum
integrates the output data ofz1
. The estimated transfer function should therefore contain an integrator.
Create a transfer function model with the expected structure.
init_sys = idtf([100 1500],[1 10 10 0]);
int_sys
is anidtf
model with three poles and one zero. The denominator coefficient for thes^0
term is zero which indicates thatint_sys
contains an integrator.
Specify constraints on the numerator and denominator coefficients of the transfer function model. To do so, configure fields in theStructure
property:
init_sys.Structure.Numerator.Minimum = eps; init_sys.Structure.Denominator.Minimum = eps; init_sys.Structure.Denominator.Free(end) = false;
The constraints specify that the numerator and denominator coefficients are nonnegative. Additionally, the last element of the denominator coefficients (associated with thes^0
term) is not an estimable parameter. This constraint forces one of the estimated poles to be ats = 0
.
Create an estimation option set that specifies using the Levenberg–Marquardt search method.
opt = tfestOptions('SearchMethod','lm');
Estimate a transfer function forz1
usinginit_sys
and the estimation option set.
sys = tfest(z1,init_sys,opt);
tfest
uses the coefficients ofinit_sys
to initialize the estimation ofsys
. Additionally, the estimation is constrained by the constraints you specify in theStructure
property ofinit_sys
. The resultingidtf
modelsys
contains the parameter values that result from the estimation.