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.

load iddata1 z1;
z1.y = cumsum(z1.y);

cumsum integrates the output data of z1. 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 an idtf model with three poles and one zero. The denominator coefficient for the s^0 term is zero which indicates that int_sys contains an integrator.

Specify constraints on the numerator and denominator coefficients of the transfer function model. To do so, configure fields in the Structure 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 the s^0 term) is not an estimable parameter. This constraint forces one of the estimated poles to be at s = 0.

Create an estimation option set that specifies using the Levenberg–Marquardt search method.

opt = tfestOptions('SearchMethod','lm');

Estimate a transfer function for z1 using init_sys and the estimation option set.

sys = tfest(z1,init_sys,opt);

tfest uses the coefficients of init_sys to initialize the estimation of sys. Additionally, the estimation is constrained by the constraints you specify in the Structure property of init_sys. The resulting idtf model sys contains the parameter values that result from the estimation.