Main Content

Estimate Transfer Function Models With Prior Knowledge of Model Structure and Constraints

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

cumsumintegrates 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_sysis anidtfmodel with three poles and one zero. The denominator coefficient for thes^0term is zero which indicates thatint_syscontains an integrator.

Specify constraints on the numerator and denominator coefficients of the transfer function model. To do so, configure fields in theStructureproperty:

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^0term) 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 forz1usinginit_sysand the estimation option set.

sys = tfest(z1,init_sys,opt);

tfestuses the coefficients ofinit_systo initialize the estimation ofsys. Additionally, the estimation is constrained by the constraints you specify in theStructureproperty ofinit_sys. The resultingidtfmodelsyscontains the parameter values that result from the estimation.