Documentation Center

  • Trial Software
  • Product Updates

idtf

Transfer function model with identifiable parameters

Syntax

  • sys = idtf(num,den)
  • sys = idtf(num,den,Ts)
  • sys = idtf(___,Name,Value)
  • sys = idtf(sys0)

Description

sys = idtf(num,den) creates a continuous-time transfer function with identifiable parameters (an idtf model). num specifies the current values of the transfer function numerator coefficients. den specifies the current values of the transfer function denominator coefficients.

sys = idtf(num,den,Ts) creates a discrete-time transfer function with identifiable parameters. Ts is the sampling time.

sys = idtf(___,Name,Value) creates a transfer function with properties specified by one or more Name,Value pair arguments.

sys = idtf(sys0) converts any dynamic system model, sys0, to idtf model form.

Object Description

An idtf model represents a system as a continuous-time or discrete-time transfer function with identifiable (estimable) coefficients.

A SISO transfer function is a ratio of polynomials with an exponential term. In continuous time,

In discrete time,

In discrete time, zk represents a time delay of kTs, where Ts is the sampling time.

For idtf models, the denominator coefficients a0,...,am–1 and the numerator coefficients b0,...,bn can be estimable parameters. (The leading denominator coefficient is always fixed to 1.) The time delay τ (or kin discrete time) can also be an estimable parameter. The idtf model stores the polynomial coefficients a0,...,am–1 and b0,...,bn in the den and num properties of the model, respectively. The time delay τ or k is stored in the ioDelay property of the model.

A MIMO transfer function contains a SISO transfer function corresponding to each input-output pair in the system. For idtf models, the polynomial coefficients and transport delays of each input-output pair are independently estimable parameters.

There are three ways to obtain an idtf model.

  • Estimate the idtf model based on input-output measurements of a system, using tfest. The tfest command estimates the values of the transfer function coefficients and transport delays. The estimated values are stored in the num, den, and ioDelay properties of the resulting idtf model. The Report property of the resulting model stores information about the estimation, such as handling of initial conditions and options used in estimation.

    When you obtain an idtf model by estimation, you can extract estimated coefficients and their uncertainties from the model. To do so, use commands such as tfdata, getpar, or getcov.

  • Create an idtf model using the idtf command.

    You can create an idtf model to configure an initial parameterization for estimation of a transfer function to fit measured response data. When you do so, you can specify constraints on such values as the numerator and denominator coefficients and transport delays. For example, you can fix the values of some parameters, or specify minimum or maximum values for the free parameters. You can then use the configured model as an input argument to tfest to estimate parameter values with those constraints.

  • Convert an existing dynamic system model to an idtf model using the idtf command.

    Note:   Unlike idss and idpoly, idtf uses a trivial noise model and does not parameterize the noise.

    So, H = 1 in .

Examples

expand all

Continuous-Time Transfer Function

Specify a continuous-time, single-input, single-output (SISO) transfer function with estimable parameters. The initial values of the transfer function are:

num = [1 4];
den = [1 20 5];
G = idtf(num,den);

G is an idtf model. num and den specify the initial values of the numerator and denominator polynomial coefficients in descending powers of s. The numerator coefficients having initial values 1 and 4 are estimable parameters. The denominator coefficient having initial values 20 and 5 are also estimable parameters. The leading denominator coefficient is always fixed to 1.

You can use G to specify an initial parametrization for estimation with tfest.

Transfer Function with Known Input Delay and Specified Attributes

Specify a continuous-time, SISO transfer function with known input delay. The transfer function initial values are given by:

Label the input of the transfer function with the name 'Voltage' and specify the input units as volt.

Use Name,Value input pairs to specify the delay, input name, and input unit.

num = 5;
den = [1 5];
input_delay = 5.8;
input_name = 'Voltage';
input_unit = 'volt';
G = idtf(num,den,'InputDelay',input_delay,...
         'InputName',input_name,'InputUnit',input_unit);

G is an idtf model. You can use G to specify an initial parametrization for estimation with tfest. If you do so, model properties such as InputDelay, InputName, and InputUnit are applied to the estimated model. The estimation process treats InputDelay as a fixed value. If you want to estimate the delay and specify an initial value of 5.8 s, use the ioDelay property instead.

Discrete-Time Transfer Function

Specify a discrete-time SISO transfer function with estimable parameters. The initial values of the transfer function are:

Specify the sampling time as 0.2 seconds.

num = [1 -0.1];
den = [1 0.8];
Ts = 0.2
H = idtf(num,den,Ts);

num and den are the initial values of the numerator and denominator polynomial coefficients. For discrete-time systems, specify the coefficients in ascending powers of z–1.

Ts specifies the sampling time for the transfer function as 0.2 seconds.

H is an idtf model. The numerator and denominator coefficients are estimable parameters (except for the leading denominator coefficient, which is fixed to 1).

MIMO Discrete-Time Transfer Function

Specify a discrete-time, two-input, two-output transfer function. The initial values of the MIMO transfer function are:

Specify the sampling time as 0.2 seconds.

nums = {1,[1,0];[-1,2],3};
dens = {[1,0.2],[1,0.7];[1,-0.3],[1,0.3]};
Ts = 0.2
H = idtf(nums,dens,Ts);

nums and dens specify the initial values of the coefficients in cell arrays. Each entry in the cell array corresponds to the numerator or denominator of the transfer function of one input-output pair. For example, the first row of nums is {1,[1,0]}. This cell array specifies the numerators across the first row of transfer functions in H. Likewise, the first row of dens, {[1,0.2],[1,0.7]}, specifies the denominators across the first row of H.

Ts specifies the sampling time for the transfer function as 0.2 seconds.

H is an idtf model. All of the polynomial coefficients are estimable parameters, except for the leading coefficient of each denominator polynomial. These coefficients are always fixed to 1.

Specify q^-1 as Transfer Function Variable

Specify the following discrete-time transfer function in terms of q^-1:

Specify the sampling time as 0.1 seconds.

num = [1 .4];
den = [1 .1 -.3];
Ts = 0.1;
convention_variable = 'q^-1';
H = idtf(num,den,Ts,'Variable',convention_variable);

Use a Name,Value pair argument to specify the variable q^-1.

num and den are the numerator and denominator polynomial coefficients in ascending powers of q–1.

Ts specifies the sampling time for the transfer function as 0.1 seconds.

H is an idtf model.

Gain Matrix Transfer Function

Specify a transfer function with estimable coefficients whose initial value is the static gain matrix:

M = [1 0 1; 1 1 0; 3 0 2];
H = idtf(M);

H is an idtf model that describes a three input (Nu=3), three output (Ny=3) transfer function. Each input/output channel is an estimable static gain. The initial values of the gains are given by the values in the matrix M.

Convert Identifiable State-Space Model to Identifiable Transfer Function

Convert a state-space model with identifiable parameters to a transfer function with identifiable parameters.

Convert the following identifiable state-space model to an identifiable transfer function.

A = [-0.2, 0; 0, -0.3]; B = [2;4]; C=[1, 1]; D = 0; K = [.1; .2];
sys0 = idss(A,B,C,D,K,'NoiseVariance',0.1);
sys = idtf(sys0);

A,B,C,D and K are matrices that specify sys0, an identifiable state-space model with a noise variance of 0.1.

sys = idtf(sys0) creates an idtf model, sys.

Obtain a Transfer Function by Estimation

Identify a transfer function containing a specified number of poles for given data.

Load time-domain system response data and use it to estimate a transfer function for the system.

load iddata1 z1;
np = 2;
sys = tfest(z1,np);

z1 is an iddata object that contains time-domain, input-output data.

np specifies the number of poles in the estimated transfer function.

sys is an idtf model containing the estimated transfer function.

To see the numerator and denominator coefficients of the resulting estimated model sys, enter:

sys.num
sys.den

To view the uncertainty in the estimates of the numerator and denominator and other information, use tfdata.

Obtain a Transfer Function with Prior Knowledge of Model Structure and Constraints

Identify a transfer function for given data by providing its expected structure and coefficient constraints

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. Therefore, 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.num.Minimum = eps;
init_sys.Structure.den.Minimum = eps;
init_sys.Structure.den.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.

Array of Transfer Function Models

Create an array of transfer function models with identifiable coefficients. Each transfer function in the array is of the form:

The initial value of the coefficient a varies across the array, from 0.1 to 1.0, in increments of 0.1.

H = idtf(zeros(1,1,10));
for k = 1:10
    num = k/10;
    den = [1 k/10];
    H(:,:,k) = idtf(num,den);
end

The first command preallocates a one-dimensional, 10-element array, H, and fills it with empty idtf models.

The first two dimensions of a model array are the output and input dimensions. The remaining dimensions are the array dimensions. H(:,:,k) represents the kth model in the array. Thus, the for loop replaces the kth entry in the array with a transfer function whose coefficients are initialized with a = k/10.

Input Arguments

num

Initial values of transfer function numerator coefficients.

For SISO transfer functions, specify the initial values of the numerator coefficients num as a row vector. Specify the coefficients in order of:

  • Descending powers of s or p (for continuous-time transfer functions)

  • Ascending powers of z–1 or q–1 (for discrete-time transfer functions)

Use NaN for any coefficient whose initial value is not known.

For MIMO transfer functions with Ny outputs and Nu inputs, num is a Ny-by-Nu cell array of numerator coefficients for each input/output pair.

den

Initial values of transfer function denominator coefficients.

For SISO transfer functions, specify the initial values of the denominator coefficients den as a row vector. Specify the coefficients in order of:

  • Descending powers of s or p (for continuous-time transfer functions)

  • Ascending powers of z–1 or q–1 (for discrete-time transfer functions)

The leading coefficient in den must be 1. Use NaN for any coefficient whose initial value is not known.

For MIMO transfer functions with Ny outputs and Nu inputs, den is a Ny-by-Nu cell array of denominator coefficients for each input/output pair.

Ts

Sampling time. For continuous-time models, Ts = 0. For discrete-time models, Ts is a positive scalar representing the sampling period. This value is expressed in the unit specified by the TimeUnit property of the model. To denote a discrete-time model with unspecified sampling time, set Ts = -1.

Changing this property does not discretize or resample the model. Use c2d and d2c to convert between continuous- and discrete-time representations. Use d2d to change the sampling time of a discrete-time system.

Default: 0 (continuous time)

sys0

Dynamic system.

Any dynamic system to convert to an idtf model.

When sys0 is an identified model, its estimated parameter covariance is lost during conversion. If you want to translate the estimated parameter covariance during the conversion, use translatecov.

Name-Value Pair Arguments

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.

Use Name,Value arguments to specify additional properties of idtf models during model creation. For example, idtf(num,den,'InputName','Voltage') creates an idtf model with the InputName property set to Voltage.

Properties

idtf object properties include:

num

Values of transfer function numerator coefficients.

If you create an idtf model sys using the idtf command, sys.num contains the initial values of numerator coefficients that you specify with the num input argument.

If you obtain an idtf model by identification using tfest, then sys.num contains the estimated values of the numerator coefficients.

For an idtf model sys, the property sys.num is an alias for the value of the property sys.Structure.num.Value.

For SISO transfer functions, the values of the numerator coefficients are stored as a row vector in order of:

  • Descending powers of s or p (for continuous-time transfer functions)

  • Ascending powers of z–1 or q–1 (for discrete-time transfer functions)

Any coefficient whose initial value is not known is stored as NaN.

For MIMO transfer functions with Ny outputs and Nu inputs, num is a Ny-by-Nu cell array of numerator coefficients for each input/output pair.

den

Values of transfer function denominator coefficients.

If you create an idtf model sys using the idtf command, sys.den contains the initial values of denominator coefficients that you specify with the den input argument.

If you obtain an idtf model sys by identification using tfest, then sys.den contains the estimated values of the denominator coefficients.

For an idtf model sys, the property sys.den is an alias for the value of the property sys.Structure.den.Value.

For SISO transfer functions, the values of the denominator coefficients are stored as a row vector in order of:

  • Descending powers of s or p (for continuous-time transfer functions)

  • Ascending powers of z–1 or q–1 (for discrete-time transfer functions)

The leading coefficient in den is fixed to 1. Any coefficient whose initial value is not known is stored as NaN.

For MIMO transfer functions with Ny outputs and Nu inputs, den is a Ny-by-Nu cell array of denominator coefficients for each input/output pair.

Variable

String specifying the transfer function display variable. Variable requires one of the following values:

  • 's' — Default for continuous-time models

  • 'p' — Equivalent to 's'

  • 'z^-1' — Default for discrete-time models

  • 'q^-1' — Equivalent to 'z^-1'

The value of Variable is reflected in the display, and also affects the interpretation of the num and den coefficient vectors for discrete-time models. For Variable = 'z^-1' or 'q^-1', the coefficient vectors are ordered as ascending powers of the variable.

ioDelay

Transport delays. ioDelay is a numeric array specifying a separate transport delay for each input/output pair.

If you create an idtf model sys using the idtf command, sys.ioDelay contains the initial values of the transport delay that you specify with a Name,Value argument pair.

If you obtain an idtf model sys by identification using tfest, then sys.ioDelay contains the estimated values of the transport delay.

For an idtf model sys, the property sys.ioDelay is an alias for the value of the property sys.Structure.ioDelay.Value.

For continuous-time systems, transport delays are expressed in the time unit stored in the TimeUnit property. For discrete-time systems, specify transport are expressed as integers denoting delay of a multiple of the sampling period Ts.

For a MIMO system with Ny outputs and Nu inputs, set ioDelay as a Ny-by-Nu array. Each entry of this array is a numerical value representing the transport delay for the corresponding input/output pair. You can set ioDelay to a scalar value to apply the same delay to all input/output pairs.

Default: 0 for all input/output pairs

Structure

Information about the estimable parameters of the idtf model. Structure.num, Structure.den, and Structure.ioDelay contain information about the numerator coefficients, denominator coefficients, and transport delay, respectively. Each contains the following fields:

  • Value — Parameter values. For example, sys.Structure.num.Value contains the initial or estimated values of the numerator coefficients.

    NaN represents unknown parameter values. For denominators, the value of the leading coefficient, specified by sys.Structure.den.Value(1) is fixed to 1.

    For SISO models, sys.num, sys.den, and sys.ioDelay are aliases for sys.Structure.num.Value, sys.Structure.den.Value, and sys.Structure.ioDelay.Value, respectively.

    For MIMO models, sys.num{i,j} is an alias for sys.Structure(i,j).num.Value, and sys.den{i,j} is an alias for sys.Structure(i,j).den.Value. Additionally, sys.ioDelay(i,j) is an alias for sys.Structure(i,j).ioDelay.Value

  • Minimum — Minimum value that the parameter can assume during estimation. For example, sys.Structure.ioDelay.Minimum = 0.1 constrains the transport delay to values greater than or equal to 0.1.

    sys.Structure.ioDelay.Minimum must be greater than or equal to zero.

  • Maximum — Maximum value that the parameter can assume during estimation.

  • Free — Boolean specifying whether the parameter is a free estimation variable. If you want to fix the value of a parameter during estimation, set the corresponding Free = false. For example, sys.Structure.den.Free = false fixes all of the denominator coefficients in sys to the values specified in sys.Structure.den.Value.

    For denominators, the value of Free for the leading coefficient, specified by sys.Structure.den.Free(1), is always false (the leading denominator coefficient is always fixed to 1).

  • Scale — Scale of the parameter's value. Scale is not used in estimation.

  • Info — Structure array for storing parameter units and labels. The structure has Label and Unit fields.

    Use these fields for your convenience, to store strings that describe parameter units and labels.

For a MIMO model with Ny outputs and Nu input, Structure is an Ny-by-Nu array. The element Structure(i,j) contains information corresponding to the transfer function for the (i,j) input-output pair.

NoiseVariance

The variance (covariance matrix) of the model innovations e.

An identified model includes a white, Gaussian noise component e(t). NoiseVariance is the variance of this noise component. Typically, the model estimation function (such as tfest) determines this variance.

For SISO models, NoiseVariance is a scalar. For MIMO models, NoiseVariance is a Ny-by-Ny matrix, where Ny is the number of outputs in the system.

Report

Information about the estimation process.

Report contains the following fields:

  • InitMethod — Method used to initialize model coefficients before iterative prediction error minimization

  • N4Weight — Subspace algorithm option value used by n4sidestimator (see n4sidOptions)

  • N4Horizon — Forward and backward prediction horizons used by n4sid (see n4sidOptions)

  • InitialCondition — Whether estimation estimated initial conditions or fixed them at zero

  • Fit — Quantitative quality assessment of estimation, including percent fit to data and final prediction error

  • Parameters — Estimated values of model parameters and their covariance

  • OptionsUsed — Options used during estimation (see tfestOptions)

  • RandState — Random number stream state at start of estimation

  • Status — Whether model was obtained by construction, estimated, or modified after estimation

  • Method — Name of estimation method used

  • DataUsed — Attributes of data used for estimation, such as name and sampling time

  • Termination — Termination conditions for the iterative search scheme used for prediction error minimization, such as final cost value or stopping criterion

InputDelay

Input delays. InputDelay is a numeric vector specifying a time delay for each input channel. 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 representing 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.

Estimation treats InputDelay as a fixed constant of the model. Estimation uses the ioDelay property for estimating time delays. To specify initial values and constraints for estimation of time delays, use sys.Structure.ioDelay.

Default: 0 for all input channels

OutputDelay

Output delays.

For identified systems, like idtf, OutputDelay is fixed to zero.

Ts

Sampling time. For continuous-time models, Ts = 0. For discrete-time models, Ts is a positive scalar representing the sampling period. This value is expressed in the unit specified by the TimeUnit property of the model. To denote a discrete-time model with unspecified sampling time, set Ts = -1.

Changing this property does not discretize or resample the model. Use c2d and d2c to convert between continuous- and discrete-time representations. Use d2d to change the sampling time of a discrete-time system.

Default: 0 (continuous time)

TimeUnit

String representing the unit of the time variable. For continuous-time models, this property represents any time delays in the model. For discrete-time models, it represents the sampling time Ts. Use any of the following values:

  • 'nanoseconds'

  • 'microseconds'

  • 'milliseconds'

  • 'seconds'

  • 'minutes'

  • 'hours'

  • 'days'

  • 'weeks'

  • 'months'

  • 'years'

Changing this property changes the overall system behavior. Use chgTimeUnit to convert between time units without modifying system behavior.

Default: 'seconds'

InputName

Input channel names. Set InputName to a string for single-input model. For a multi-input model, set InputName to a cell array of strings.

Alternatively, use automatic vector expansion to assign input names for multi-input models. For example, if sys is a two-input model, enter:

sys.InputName = 'controls';

The input names automatically expand to {'controls(1)';'controls(2)'}.

When you estimate a model using an iddata object, data, the software automatically sets InputName to data.InputName.

You can use the shorthand notation u to refer to the InputName property. For example, sys.u is equivalent to sys.InputName.

Input channel names have several uses, including:

  • Identifying channels on model display and plots

  • Extracting subsystems of MIMO systems

  • Specifying connection points when interconnecting models

Default: Empty string '' for all input channels

InputUnit

Input channel units. Use InputUnit to keep track of input signal units. For a single-input model, set InputUnit to a string. For a multi-input model, set InputUnit to a cell array of strings. InputUnit has no effect on system behavior.

Default: Empty string '' for all input channels

InputGroup

Input channel groups. The InputGroup property lets you assign the input channels of MIMO systems into groups and refer to each group by name. Specify input groups as a structure. In this structure, field names are the group names, and field values are the input channels belonging to each group. For example:

sys.InputGroup.controls = [1 2];
sys.InputGroup.noise = [3 5];

creates input groups named controls and noise that include input channels 1, 2 and 3, 5, respectively. You can then extract the subsystem from the controls inputs to all outputs using:

sys(:,'controls')

Default: Struct with no fields

OutputName

Output channel names. Set OutputName to a string for single-output model. For a multi-output model, set OutputName to a cell array of strings.

Alternatively, use automatic vector expansion to assign output names for multi-output models. For example, if sys is a two-output model, enter:

sys.OutputName = 'measurements';

The output names to automatically expand to {'measurements(1)';'measurements(2)'}.

When you estimate a model using an iddata object, data, the software automatically sets OutputName to data.OutputName.

You can use the shorthand notation y to refer to the OutputName property. For example, sys.y is equivalent to sys.OutputName.

Output channel names have several uses, including:

  • Identifying channels on model display and plots

  • Extracting subsystems of MIMO systems

  • Specifying connection points when interconnecting models

Default: Empty string '' for all input channels

OutputUnit

Output channel units. Use OutputUnit to keep track of output signal units. For a single-output model, set OutputUnit to a string. For a multi-output model, set OutputUnit to a cell array of strings. OutputUnit has no effect on system behavior.

Default: Empty string '' for all input channels

OutputGroup

Output channel groups. The OutputGroup property lets you assign the output channels of MIMO systems into groups and refer to each group by name. Specify output groups as a structure. In this structure, field names are the group names, and field values are the output channels belonging to each group. For example:

sys.OutputGroup.temperature = [1];
sys.InputGroup.measurement = [3 5];

creates output groups named temperature and measurement that include output channels 1, and 3, 5, respectively. You can then extract the subsystem from all inputs to the measurement outputs using:

sys('measurement',:)

Default: Struct with no fields

Name

System name. Set Name to a string to label the system.

Default: ''

Notes

Any text that you want to associate with the system. Set Notes to a string or a cell array of strings.

Default: {}

UserData

Any type of data you wish to associate with system. Set UserData to any MATLAB® data type.

Default: []

SamplingGrid

Sampling grid for model arrays, specified as a data structure.

For arrays of identified linear (IDLTI) models that are derived by sampling one or more independent variables, this property tracks the variable values associated with each model. This information appears when you display or plot the model array. Use this information to trace results back to the independent variables.

Set the field names of the data structure to the names of the sampling variables. Set the field values to the sampled variable values associated with each model in the array. All sampling variables should be numeric and scalar valued, and all arrays of sampled values should match the dimensions of the model array.

For example, if you collect data at various operating points of a system, you can identify a model for each operating point separately and then stack the results together into a single system array. You can tag the individual models in the array with information regarding the operating point:

nominal_engine_rpm = [1000 5000 10000];
sys.SamplingGrid = struct('rpm', nominal_engine_rpm)

where sys is an array containing three identified models obtained at rpms 1000, 5000 and 10000, respectively.

Default: []

See Also

| | | | | | | | |

Was this topic helpful?