Main Content

idtf

Transfer function model with identifiable parameters

Description

An idtf model represents a system as a continuous-time or discrete-time transfer function with identifiable (estimable) coefficients. Use idtf to create a transfer function model, or to convert Dynamic System Models to transfer function form.

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

G(s)=eτsbnsn+bn1sn1+...+b0sm+am1sm1+...+a0.

In discrete time,

G(z1)=zkbnzn+bn1zn+1+...+b0zm+am1zm+1+...+a0.

In discrete time, zk represents a time delay of kTs, where Ts is the sample 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 k in discrete time) can also be an estimable parameter. The idtf model stores the polynomial coefficients a0,...,am–1 and b0,...,bn in the Denominator and Numerator properties of the model, respectively. The time delay τ or k is stored in the IODelay property of the model.

Unlike idss and idpoly, idtf fixes the noise parameter to 1 rather than parameterizing it. So, in y=Gu+He, H = 1.

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.

Creation

You can obtain an idtf model object in one of three ways.

  • 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 Numerator, Denominator, and IODelay properties of the resulting idtf model. When you reference numerator and denominator properties, you can use the shortcuts num and den. The Report property of the resulting model stores information about the estimation, such as handling of initial conditions and options used in estimation. For example, you can use the following commands to estimate and get information about a transfer function.

    sys = tfest(data,nx);
    num = sys.Numerator;
    den = sys.den;
    sys.Report

    For more examples of estimating an idtf model, see tfest.

    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. For example, create an idtf model with the numerator and denominator that you specify.

    sys = idtf(num,den)
    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. For examples, see Create Continuous-Time Transfer Function Model and Create Discrete-Time Transfer Function.

  • Convert an existing dynamic system model to an idtf model using the idtf command. For example, convert the state-space model sys_ss to a transfer function.

    sys_tf = idtf(sys_ss);
    For a more detailed example, see Convert Identifiable State-Space Model to Identifiable Transfer Function

For information on functions you can use to extract information from or transform idtf model objects, see Object Functions.

Description

Create Transfer Function Model

example

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

example

sys = idtf(numerator,denominator,Ts) creates a discrete-time transfer function model with sample time Ts.

example

sys = idtf(___,Name,Value) creates a transfer function with the properties specified by one or more Name,Value pair arguments. Specify name-value pair arguments after any of the input argument combinations in the previous syntaxes.

Convert Dynamic System Model to Transfer Function Model

example

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

Input Arguments

expand all

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.

Properties

expand all

Values of transfer function numerator coefficients, specified as a row vector or a cell array.

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

  • 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, Numerator is a Ny-by-Nu cell array of numerator coefficients for each input/output pair. For an example of a MIMO transfer function, see Create MIMO Discrete-Time Transfer Function.

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

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

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

Values of transfer function denominator coefficients, specified as a row vector or a cell array.

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

  • 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 Denominator 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, Denominator is an Ny-by-Nu cell array of denominator coefficients for each input-output pair. For an example of a MIMO transfer function, see Create MIMO Discrete-Time Transfer Function.

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

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

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

Transfer function display variable, specified as 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 Numerator and Denominator coefficient vectors for discrete-time models. When Variable is set to 'z^-1' or 'q^-1', the coefficient vectors are ordered as ascending powers of the variable.

For an example of using the Variable property, see Specify Transfer Function Display Variable.

Transport delays, specified as a numeric array containing a separate transport delay for each input-output pair.

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

For a MIMO system with Ny outputs and Nu inputs, set IODelay as an 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.

If you create an idtf model sys using the idtf command, then sys.IODelay contains the initial values of the transport delay that you specify with a name-value pair argument.

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.

Property-specific information about the estimable parameters of the idtf model, specified as a single structure or an array of structures.

  • SISO system — Single structure.

  • MIMO system with Ny outputs and Nu inputs — Ny-by-Nu array. The element Structure(i,j) contains information corresponding to the transfer function for the (i,j) input-output pair.

Structure.Numerator, Structure.Denominator, and Structure.IODelay contain information about the numerator coefficients, denominator coefficients, and transport delay, respectively. Each parameter in Structure contains the following fields.

FieldDescriptionExamples
ValueParameter values. Each property is an alias of the corresponding Value entry in the Structure property of sys.NaN represents unknown parameter values.sys.Structure.Numerator.Value contains the initial or estimated values of SISO numerator coefficients. sys.Numerator is an alias of the value of this property. sys.Numerator{i,j} is the alias of the MIMO property sys.Structure(i,j).Numerator.Value.
MinimumMinimum value that the parameter can assume during estimation. 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.
MaximumMaximum value that the parameter can assume during estimation.sys.Structure.IODelay.Maximum = 0.5 constrains the transport delay to values less than or equal to 0.5. sys.Structure.IODelay.Maximum must be greater than or equal to zero.
FreeBoolean 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 value to false. For denominators, the value of Free for the leading coefficient, specified by sys.Structure.Denominator.Free(1), is always false (the leading denominator coefficient is always fixed to 1).sys.Structure.Denominator.Free = false fixes all of the denominator coefficients in sys to the values specified in sys.Structure.Denominator.Value.
ScaleScale of the value of the parameter. The estimation algorithm does not use Scale. 
InfoStructure array that contains the fields Label and Unit for storing parameter labels and units. Specify parameter labels and units as character vectors.'Time'

Variance (covariance matrix) of the model innovations e, specified as a scalar or matrix.

  • SISO model — Scalar

  • MIMO model with Ny outputs — Ny-by-Ny matrix

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.

This property is read-only.

Summary report that contains information about the estimation options and results for a state-space model obtained using estimation commands, such as tfest and impulseest. Use Report to find estimation information for the identified model, including:

  • Estimation method

  • Estimation options

  • Search termination conditions

  • Estimation data fit and other quality metrics

If you create the model by construction, the contents of Report are irrelevant.

sys = idtf([1 4],[1 20 5]);
sys.Report.OptionsUsed
ans =

     []

If you obtain the model using estimation commands, the fields of Report contain information on the estimation data, options, and results.

load iddata2 z2;
sys = tfest(z2,3);
sys.Report.OptionsUsed
 InitializeMethod: 'iv'
     InitializeOptions: [1×1 struct]
      InitialCondition: 'auto'
               Display: 'off'
           InputOffset: []
          OutputOffset: []
    EstimateCovariance: 1
        Regularization: [1×1 struct]
          SearchMethod: 'auto'
         SearchOptions: [1×1 idoptions.search.identsolver]
       WeightingFilter: []
      EnforceStability: 0
          OutputWeight: []
              Advanced: [1×1 struct]

For more information on this property and how to use it, see the Output Arguments section of the corresponding estimation command reference page and Estimation Report.

Input delay for each input channel, specified as a scalar value or 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 sample time Ts. For example, setting InputDelay to 3 specifies a delay of three sample times.

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.

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

For identified systems such as idtf, OutputDelay is fixed to zero.

Sample time, specified as one of the following.

  • Continuous-time model — 0

  • Discrete-time model with a specified sampling time — Positive scalar representing the sampling period expressed in the unit specified by the TimeUnit property of the model

  • Discrete-time model with unspecified sample time — -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 sample time of a discrete-time system.

Units for the time variable, the sample time Ts, and any time delays in the model, specified as a scalar.

Changing this property does not resample or convert the data. Modifying the property changes only the interpretation of the existing data. Use chgTimeUnit to convert data to different time units.

Input channel names, specified as a character vector or cell array.

  • Single-input model — Character vector, for example, 'controls'

  • Multi-input model — Cell array of character vectors

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.

You can use input channel names in several ways, including:

  • To identify channels on model display and plots

  • To extract subsystems of MIMO systems

  • To specify connection points when interconnecting models

Input channel units, specified as a character vector or cell array.

  • Single-input model — Character vector

  • Multi-input Model — Cell array of character vectors

Use InputUnit to keep track of input signal units. InputUnit has no effect on system behavior.

Input channel groups, specified as a structure. The InputGroup property lets you divide the input channels of MIMO systems into groups so that you can refer to each group by name. In the InputGroup structure, set field names to the group names, and field values to the input channels belonging to each group.

For example, create input groups named controls and noise that include input channels 1, 2 and 3, 5, respectively.

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

You can then extract the subsystem from the controls inputs to all outputs using the following syntax:

sys(:,'controls')

Output channel names, specified as a character vector or cell array.

  • Single-input model — Character vector, for example, 'measurements'

  • Multi-input model — Cell array of character vectors

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 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.

You can use output channel names in several ways, including:

  • To identify channels on model display and plots

  • To extract subsystems of MIMO systems

  • To specify connection points when interconnecting models

Output channel units, specified as a character vector or cell array.

  • Single-input model — Character vector, for example, 'seconds'

  • Multi-input Model — Cell array of character vectors

Use OutputUnit to keep track of output signal units. OutputUnit has no effect on system behavior.

Output channel groups, specified as a structure. The OutputGroup property lets you divide the output channels of MIMO systems into groups and refer to each group by name. In the OutputGroup structure, set field names to the group names, and field values to the output channels belonging to each group.

For example, create output groups named temperature and measurement that include output channels 1 and 3, 5, respectively.

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

You can then extract the subsystem from all inputs to the measurement outputs using the following syntax:

sys('measurement',:)

System name, specified as a character vector, for example, 'system_1'.

Any text that you want to associate with the system, specified as a string or a cell array of character vectors. The property stores whichever data type you provide. For instance, if sys1 and sys2 are dynamic system models, you can set their Notes properties as follows.

sys1.Notes = "sys1 has a string.";
sys2.Notes = 'sys2 has a character vector.';
sys1.Notes
sys2.Notes
ans = 

    "sys1 has a string."


ans =

    'sys2 has a character vector.'

Data to associate with the system, specified as any MATLAB data type.

Sampling grid for model arrays, specified as a structure.

For arrays of identified linear (IDLTI) models that you derive 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 must be numeric and scalar valued, and all arrays of sampled values must match the dimensions of the model array.

For example, suppose that 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)

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

For model arrays that you generate by linearizing a Simulink® model at multiple parameter values or operating points, the software populates SamplingGrid automatically with the variable values that correspond to each entry in the array.

Object Functions

In general, any function applicable to Dynamic System Models is applicable to an idtf model object. These functions are of four general types.

  • Functions that operate and return idtf model objects enable you to transform and manipulate idtf models. For instance:

    • Use merge to merge estimated idtf models.

    • Use c2d to convert an idtf from continuous to discrete time. Use d2c to convert an idtf from discrete to continuous time.

  • Functions that perform analytical and simulation functions on idtf objects, such as bode and sim

  • Functions that retrieve or interpret model information, such as advice and getpar

  • Functions that convert idtf objects into a different model type, such as idpoly for time domain or idfrd for frequency domain

The following lists contain a representative subset of the functions that you can use with idtf models.

expand all

translatecovTranslate parameter covariance across model transformation operations
setparSet initial parameter values of idnlgrey model object
chgTimeUnitChange time units of dynamic system
d2dResample discrete-time model
d2cConvert model from discrete to continuous time
c2dConvert model from continuous to discrete time
mergeMerge estimated models

expand all

simSimulate response of identified model
predictPredict state and state estimation error covariance at next time step using extended or unscented Kalman filter, or particle filter
compareCompare identified model output and measured output
impulseImpulse response plot of dynamic system; impulse response data
stepStep response plot of dynamic system; step response data
bodeBode plot of frequency response, or magnitude and phase data

expand all

tfdataAccess transfer function data
getAccess model property values
getparParameter values and properties of idnlgrey model parameters
getcovParameter covariance of identified model
adviceAnalysis and recommendations for data or estimated linear models

expand all

idpolyPolynomial model with identifiable parameters
idssState-space model with identifiable parameters
idfrdFrequency-response data or model

Examples

collapse all

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

G(s)=s+4s2+20s+5

num = [1 4];
den = [1 20 5];
G = idtf(num,den)
G =
 
      s + 4
  --------------
  s^2 + 20 s + 5
 
Continuous-time identified transfer function.

Parameterization:
   Number of poles: 2   Number of zeros: 1
   Number of free coefficients: 4
   Use "tfdata", "getpvec", "getcov" for parameters and their uncertainties.

Status:                                                         
Created by direct construction or transformation. Not estimated.

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 with initial values 1 and 4 are estimable parameters. The denominator coefficients with 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 parameterization for estimation with tfest.

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

G(s)=e-5.8s5s+5

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

Use name-value pair arguments 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 parameterization 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.

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

H(z)=z-0.1z+0.8

Specify the sample 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 sample 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).

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

H(z)=[1z+0.2zz+0.7-z+2z-0.33z+0.3]

Specify the sample 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 sample 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 the following discrete-time transfer function in terms of q^-1:

H(q-1)=1+0.4q-11+0.1q-1-0.3q-2

Specify the sample time as 0.1 seconds.

num = [1 0.4];
den = [1 0.1 -0.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 sample time for the transfer function as 0.1 seconds.

H is an idtf model.

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

H(s)=[101110302]

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 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.

x(t)=[-0.200-0.3]x(t)+[-24]u(t)+[0.10.2]e(t)y(t)=[11]x(t)

A = [-0.2, 0; 0, -0.3];
B = [2;4];
C = [1, 1];
D = 0;
K = [0.1; 0.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.

Load the time-domain system-response data z1.

load iddata1 z1;

Set the number of poles np to 2 and estimate a transfer function.

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

sys is an idtf model containing the estimated two-pole transfer function.

View the numerator and denominator coefficients of the resulting estimated model sys.

sys.Numerator
ans = 1×2

    2.4554  176.9856

sys.Denominator
ans = 1×3

    1.0000    3.1625   23.1631

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

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

H(s)=as+a.

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.

Introduced in R2012a