# tfest

Transfer function estimation

## Syntax

`sys = tfest(data,np)sys = tfest(data,np,nz)sys = tfest(data,np,nz,iodelay)sys = tfest(___,Name,Value)sys = tfest(data,init_sys)sys = tfest(___,opt)`

## Description

`sys = tfest(data,np)` estimates a continuous-time transfer function, `sys`, using time- or frequency-domain data, `data`, and contains `np` poles. The number of zeros in the `sys` is `max(np-1,0)`.

`sys = tfest(data,np,nz)` estimates a transfer function containing `nz` zeros.

`sys = tfest(data,np,nz,iodelay)` estimates a transfer function with transport delay for input/output pairs `iodelay`.

`sys = tfest(___,Name,Value)` uses additional options specified by one or more `Name,Value` pair arguments. All input arguments described for previous syntaxes also apply here.

`sys = tfest(data,init_sys)` uses the dynamic system `init_sys` to configure the initial parameterization of `sys`.

`sys = tfest(___,opt)` specifies the estimation behavior using the option set `opt`. All input arguments described for previous syntaxes also apply here.

## Input Arguments

 `data` Estimation data. For time domain estimation, `data` is an `iddata` object containing the input and output signal values. Time-series models, which are models that contain no measured inputs, cannot be estimated using `tfest`. Use `ar`, `arx` or `armax` for time-series models instead. For frequency domain estimation, `data` can be one of the following: `frd` or `idfrd` object that represents recorded frequency response data:Complex-values G(eiω) , for given frequencies ωAmplitude $|G|$ and phase shift $\phi =\mathrm{arg}G$ values`iddata` object with its properties specified as follows:`InputData` — Fourier transform of the input signal`OutputData` — Fourier transform of the output signal`Domain` — `'Frequency'` For multi-experiment data, the sample times and intersample behavior of all the experiments must match. `np` Number of poles in the estimated transfer function. `np` is a nonnegative number. For systems that are multiple-input, or multiple-output, or both: To use the same number of poles for all the input/output pairs, specify `np` as a scalar.To use different number of poles for the input/output pairs, specify `np` as an ny-by-nu matrix. ny is the number of outputs, and nu is the number of inputs. `nz` Number of zeros in the estimated transfer function. `nz` is a nonnegative number. For systems that are multiple-input, or multiple-output, or both: To use the same number of zeros for all the input/output pairs, specify `nz` as a scalar.To use a different number of zeros for the input/output pairs, specify `nz` as an ny-by-nu matrix. ny is the number of outputs, and nu is the number of inputs. For a continuous-time model, estimated using discrete-time data, set `nz <= np`. `iodelay` Transport delay. For continuous-time systems, specify transport delays in the time unit stored in the `TimeUnit` property of `data`. For discrete-time systems, specify transport delays as integers denoting delay of a multiple of the sample time `Ts`. For a MIMO system with ny outputs and nu inputs, set `iodelay` to an ny-by-nu array. Each entry of this array is a numerical value that represents the transport delay for the corresponding input/output pair. You can also set `iodelay` to a scalar value to apply the same delay to all input/output pairs. The specified values are treated as fixed delays. `iodelay` must contain either nonnegative numbers or NaNs. Use NaN in the `iodelay` matrix to denote unknown transport delays. Use `[]` or `0` to indicate that there is no transport delay. `opt` Estimation options. `opt` is an options set, created using `tfestOptions`, that specifies estimation options including: Estimation objectiveHandling of initial conditionsNumerical search method to be used in estimation `init_sys` Dynamic system that configures the initial parameterization of `sys`. If `init_sys` is an `idtf` model, `tfest` uses the parameters and constraints defined in `init_sys` as the initial guess for estimating `sys`. Use the `Structure` property of `init_sys` to configure initial guesses and constraints for the numerator, denominator and transport lag. To specify an initial guess for, say, the numerator of `init_sys`, set `init_sys.Structure.num.Value` to the initial guess. To specify constraints for, say, the numerator of `init_sys`: Set `init_sys.Structure.num.Minimum` to the minimum numerator coefficient valuesSet `init_sys.Structure.num.Maximum` to the maximum numerator coefficient valuesSet `init_sys.Structure.num.Free` to indicate which numerator coefficients are free for estimation You can similarly specify the initial guess and constraints for the denominator and transport lag. If `init_sys` is not an `idtf` model, the software first converts `init_sys` to a transfer function. `tfest` uses the parameters of the resulting model as the initial guess for estimation.

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

 `'Ts'` Sample time. Use the following values for `Ts`: `0` — Continuous-time model.`data.Ts` — Discrete-time model. In this case, `np` and `nz` refer to the number of roots of `z^-1` for the numerator and denominator polynomials. Default: `0` `'InputDelay'` 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, ```InputDelay = 3``` means 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. Default: 0 `'Feedthrough'` Feedthrough for discrete-time transfer function. Must be a Ny-by-Nu logical matrix. Use a scalar to specify a common value across all channels. A discrete-time model with 2 poles and 3 zeros takes the following form: $H{z}^{-1}=\frac{b0+b1{z}^{-1}+b2{z}^{-2}+b3{z}^{-3}}{1+a1{z}^{-1}+a2{z}^{-2}}$ When the model has direct feedthrough, `b0` is a free parameter whose value is estimated along with the rest of the model parameters `b1`, `b2`, `b3`, `a1`, `a2`. When the model has no feedthrough, `b0` is fixed to zero. Default: `false` (Ny,Nu)

## Output Arguments

 `sys` Identified transfer function. `sys` is an `idtf` model that encapsulates the identified transfer function.

## Examples

collapse all

### Specify Number of Poles in Estimated Transfer Function

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

### Specify Number of Poles and Zeros in Estimated Transfer Function

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

```load iddata2 z2; np = 2; nz = 1; sys = tfest(z2,np,nz);```

`z2` is an `iddata` object that contains time domain system response data.

`np` and `nz` specify the number of poles and zeros in the estimated transfer function, respectively.

`sys` is an `idtf` model containing the estimated transfer function.

### Estimate Transfer Function Containing Known Transport Delay

Load time domain system response data and use it to estimate a transfer function for the system. Specify a known transport delay for the transfer function.

```load iddata2 z2; np = 2; nz = 1; iodelay = 0.2; sys = tfest(z2,np,nz,iodelay);```

`z2` is an `iddata` object that contains time domain system response data.

`np` and `nz` specify the number of poles and zeros in the estimated transfer function, respectively.

`iodelay` specifies the transport delay for the estimated transfer function as 0.2 seconds.

`sys` is an `idtf` model containing the estimated transfer function, with `ioDelay` set to 0.2 seconds.

### Estimate Transfer Function Containing Unknown Transport Delay

Load time domain system response data and use it to estimate a transfer function for the system. Specify an unknown transport delay for the transfer function.

```load iddata2 z2; np = 2; nz = 1; iodelay = NaN; sys = tfest(z2,np,nz,iodelay);```

`z2` is an `iddata` object that contains time domain system response data.

`np` and `nz` specify the number of poles and zeros in the estimated transfer function, respectively.

`iodelay` specifies the transport delay for the estimated transfer function. `iodelay = NaN` denotes the transport delay as an unknown parameter to be estimated.

`sys` is an `idtf` model containing the estimated transfer function, whose `ioDelay` is estimated using data.

### Estimate Discrete-Time Transfer Function With No Feedthrough

```load iddata2 z2; ```

`z2` is an `iddata` object that contains time domain system response data.

Estimate a transfer function with a sample time and known transport delay

```np = 2; nz = 1; iodelay = 2; Ts = 0.1; sysd = tfest(z2,np,nz,iodelay,'Ts',Ts);```

By default, the model has no feedthrough.

### Estimate Discrete-Time Transfer Function With Feedthrough

Estimate a discrete-time transfer function whose numerator polynomial has a nonzero leading coefficient.

```load iddata5 z5 np = 3; nz = 1; model = tfest(z5,np,nz,'ts',z5.ts,'Feedthrough',true);```

### Analyze the Origin of Delay in Measured Data

Compare two discrete-time models with and without feedthrough and transport delay.

If there is a delay from the measured input to output, it can be attributed to a lack of feedthrough or to a true transport delay. For discrete-time models, absence of feedthrough corresponds to a lag of 1 sample between the input and output. Estimating a model with `Feedthrough = false` and `ioDelay = 0` thus produces a discrete-time system that is equivalent to a system with `Feedthrough = true` and `ioDelay = 1`. Both systems show the same time- and frequency-domain responses, for example, on step and Bode plots. However, you get different results if you reduce these models using `balred` or convert them to their continuous-time representation. Therefore, you should check if the observed delay should be attributed to transport delay or to a lack of feedthrough.

Estimate a discrete-time model with no feedthrough.

```load iddata1 z1 np = 2; nz = 2; model1 = tfest(z1, np, nz, 'Ts', z1.Ts); ```

`model1` has a transport delay of 1 sample and its `ioDelay` property is 0. Its numerator polynomial begins with .

Estimate another discrete-time model with feedthrough and 1 sample input-output delay.

```model2 = tfest(z1, np, nz-1, 1, 'Ts', z1.Ts, 'Feedthrough', true); ```

Compare the Bode response of the models.

```bode(model1,model2); ```

The equations for `model1` and `model2` are equivalent, but the transport delay of `model2` has been absorbed into the numerator of `model1`.

Convert the models to continuous time, and compare their Bode responses.

```bode(d2c(model1),d2c(model2)); ```

As the plot shows, the Bode responses of the two models do not match when you convert them to continuous time.

### Estimate MISO Discrete-Time Transfer Function with Feedthrough and Delay Specifications for Individual Channels

Estimate a 2-input, 1-output discrete-time transfer function with a delay of 2 samples on first input and zero seconds on the second input. Both inputs have no feedthrough.

Split data into estimation and validation data sets.

```load iddata7 z7 ze = z7(1:300); zv = z7(200:400); ```

Estimate a 2-input, 1-output transfer function with 2 poles and 1 zero for each input-to-output transfer function.

```Lag = [2; 0]; Ft = [false, false]; model = tfest(ze, 2, 1, 'Ts', z7.Ts, 'Feedthrough', Ft, 'InputDelay', Lag); ```

Choice of `Feedthrough` dictates whether the leading numerator coefficient is zero (no feedthrough) or not (nonzero feedthrough). Delays are expressed separately using `InputDelay` or `ioDelay` property. This example uses `InputDelay` to express the delays.

Validate the estimated model. Exclude the data outliers for validation.

```I = 1:201; I(114:118) = []; opt = compareOptions('Samples',I); compare(zv, model, opt) ```

### Estimate Transfer Function Model Using Regularization

Identify a 15th order transfer function model from data collected by simulating a high-order system.

`load regularizationExampleData m0simdata;`

Estimate an unregularized transfer function model.

`m = tfest(m0simdata, 15);`

Estimate a regularized transfer function model.

```opt = tfestOptions; opt.Regularization.Lambda = 0.02632; mr = tfest(m0simdata, 15, opt); ```

Compare the model outputs with data.

`compare(m0simdata, m, mr);`

### Estimate Transfer Function Model Using Regularized Impulse Response Model

Identify a 15th order transfer function model by using regularized impulse response estimation

`load regularizationExampleData m0simdata;`

Obtain regularized impulse response (FIR) model.

```opt = impulseestOptions('RegulKernel', 'DC'); m0 = impulseest(m0simdata, 70, opt); ```

Convert model into a transfer function model after reducing order to 15.

`m = idtf(balred(idss(m0),15));`

Compare the model output with data.

`compare(m0simdata, m);`

### Specify Estimation Options

Create the options set for `tfest`.

`opt = tfestOptions('InitMethod', 'n4sid', 'Display', 'on', 'SearchMethod','lsqnonlin');`

`opt` specifies that the initialization method as `'n4sid'`, and the search method as `'lsqnonlin'`. It also specifies that the loss-function values for each iteration be shown.

Load time domain system response data and use it to estimate a transfer function for the system. Specify the estimation options using `opt`.

```load iddata2 z2; np = 2; nz = 1; iodelay = 0.2; sysc = tfest(z2,np,nz,iodelay,opt); ```

`z2` is an `iddata` object that contains time domain system response data.

`np` and `nz` specify the number of poles and zeros in the estimated transfer function, respectively.

`iodelay` specifies the transport delay for the estimated transfer function as 0.2 seconds.

`opt` specifies the estimation options.

`sys` is an `idtf` model containing the estimated transfer function.

### Specify Model Properties of the Estimated Transfer Function

Load time domain system response data, and use it to estimate a transfer function for the system. Specify the input delay for the estimated transfer function.

```load iddata2 z2; np = 2; nz = 1; input_delay = 0.2; sys = tfest(z2,np,nz,'InputDelay',input_delay)```

`z2` is an `iddata` object that contains time domain system response data.

`np` and `nz` specify the number of poles and zeros in the estimated transfer function, respectively.

`input_delay` specifies the input delay for the estimated transfer function as 0.2 seconds.

`sys` is an `idtf` model containing the estimated transfer function with an input delay of 0.2 seconds.

### Convert Frequency Response Data (FRD) into Transfer Function

This example shows how to convert frequency-response data into transfer function.

This example requires a Control System Toolbox™ license.

Obtain frequency response data.

For example, use `bode` to obtain the magnitude and phase response data for the following system:

$H\left(s\right)=\frac{s+0.2}{{s}^{3}+2{s}^{2}+s+1}$

Use 100 frequency points, ranging from 0.1 rad/s to 10 rad/s, to obtain the frequency response data. Use `frd` to create a frequency response data object.

```freq = logspace(-1,1,100); [mag, phase] = bode(tf([1 .2],[1 2 1 1]),freq); data = frd(mag.*exp(1j*phase*pi/180),freq);```

Estimate a transfer function using `data`.

```np = 3; nz = 1; sys = tfest(data,np,nz); ```

`np` and `nz` specify the number of poles and zeros in the estimated transfer function, respectively.

`sys` is an `idtf` model containing the estimated transfer function.

### Estimate Transfer Function with Transport Delay to Fit Given Frequency Response Data

Estimate a transfer function to fit a given frequency response data (FRD) containing additional phase roll off induced by input delay.

This example requires a Control System Toolbox license.

Obtain frequency response data.

For this example, use `bode` to obtain the magnitude and phase response data for the following system:

$H\left(s\right)={e}^{-.5s}\frac{s+0.2}{{s}^{3}+2{s}^{2}+s+1}$

Use 100 frequency points, ranging from 0.1 rad/s to 10 rad/s, to obtain the frequency response data. Use `frd` to create a frequency response data object.

```freq = logspace(-1,1,100); [mag, phase] = bode(tf([1 .2],[1 2 1 1],'InputDelay',.5),freq); data = frd(mag.*exp(1j*phase*pi/180),freq);```

`data` is an `iddata` object that contains frequency response data for the described system.

Estimate a transfer function using `data`. Specify an unknown transport delay for the estimated transfer function.

```np = 3; nz = 1; iodelay = NaN; sys = tfest(data,np,nz,iodelay)```

`np` and `nz` specify the number of poles and zeros in the estimated transfer function, respectively.

`iodelay` specifies an unknown transport delay for the estimated transfer function.

`sys` is an `idtf` model containing the estimated transfer function.

### Specify Estimated Transfer Function Model Structure and Coefficient Constraints

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

### Estimate Transfer Function with Known Transport Delays for Multiple Inputs

Load time domain system response data.

```load co2data; Ts = 0.5; data = iddata(Output_exp1,Input_exp1,Ts); ```

`data` is an `iddata` object and has a sample rate of 0.5 seconds.

Specify the search method as `gna`. Also specify the maximum search iterations and input/output offsets.

```opt = tfestOptions('SearchMethod','gna'); opt.InputOffset = [170; 50]; opt.OutputOffset = mean(data.y(1:75)); opt.SearchOption.MaxIter = 50; ```

`opt` is an estimation option set that specifies the search method as `gna`, with a maximum of 50 iterations. `opt` also specifies the input offset and the output offset.

Estimate a transfer function using the measured data and the estimation option set. Specify the transport delays from the inputs to the output.

```np = 3; nz = 1; iodelay = [2 5]; sys = tfest(data,np,nz,iodelay,opt);```

`iodelay` specifies the input to output delay from the first and second inputs to the output as 2 seconds and 5 seconds, respectively.

`sys` is an `idtf` model containing the estimated transfer function.

### Estimate Transfer Function with Known and Unknown Transport Delays

Load time domain system response data and use it to estimate a transfer function for the system. Specify the known and unknown transport delays.

```load co2data; Ts = 0.5; data = iddata(Output_exp1,Input_exp1,Ts); ```

`data` is an `iddata` object and has a sample rate of 0.5 seconds.

Specify the search method as `gna`. Also specify the maximum search iterations and input/output offsets.

```opt = tfestOptions('Display','on','SearchMethod','gna'); opt.InputOffset = [170; 50]; opt.OutputOffset = mean(data.y(1:75)); opt.SearchOption.MaxIter = 50; ```

`opt` is an estimation option set that specifies the search method as `gna`, with a maximum of 50 iterations. `opt` also specifies the input/output offsets.

Estimate the transfer function. Specify the unknown and known transport delays.

```np = 3; nz = 1; iodelay = [2 nan]; sys = tfest(data,np,nz,iodelay,opt) ```

`iodelay` specifies the transport delay from the first input to the output as 2 seconds. Using `NaN` specifies the transport delay from the second input to the output as unknown.

`sys` is an `idtf` model containing the estimated transfer function.

### Estimate Transfer Function with Unknown, Constrained Transport Delays

Create a transfer function model with the expected numerator and denominator structure and delay constraints.

In this example, the experiment data consists of two inputs and one output. Both transport delays are unknown and have an identical upper bound. Additionally, the transfer functions from both inputs to the output are identical in structure.

```init_sys = idtf(NaN(1,2),[1, NaN(1,3)],'ioDelay',NaN); init_sys.Structure(1).ioDelay.Free = true; init_sys.Structure(1).ioDelay.Maximum = 7; ```

`init_sys` is an `idtf` model describing the structure of the transfer function from one input to the output. The transfer function consists of one zero, three poles and a transport delay. The use of `NaN` indicates unknown coefficients.

`init_sys.Structure(1).ioDelay.Free = true` indicates that the transport delay is not fixed.

`init_sys.Structure(1).ioDelay.Maximum = 7` sets the upper bound for the transport delay to 7 seconds.

Specify the transfer function from both inputs to the output.

`init_sys = [init_sys, init_sys];`

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

```load co2data; Ts = 0.5; data = iddata(Output_exp1,Input_exp1,Ts); opt = tfestOptions('Display','on','SearchMethod','gna'); opt.InputOffset = [170; 50]; opt.OutputOffset = mean(data.y(1:75)); opt.SearchOption.MaxIter = 50; sys = tfest(data,init_sys,opt) ```

`data` is an `iddata` object and has a sample rate of 0.5 seconds.

`opt` is an estimation option set that specifies the search method as `gna`, with a maximum of 50 iterations. `opt` also specifies the input offset and the output offset.

`sys` is an `idtf` model containing the estimated transfer function.

Analyze the estimation result by comparison.

```opt2 = compareOptions; opt2.InputOffset = opt.InputOffset; opt2.OutputOffset = opt.OutputOffset; compare(data, sys, opt2)```

### Estimate Transfer Function Containing Different Number of Poles for Input/Output Pairs

Estimate a multiple-input, single-output transfer function containing different number of poles for input/output pairs for given data.

This example requires a Control System Toolbox license.

Obtain frequency response data.

For example, use `frd` to frequency response data model for the following system:

$G=\left[\begin{array}{c}{e}^{-4s}\frac{s+2}{{s}^{3}+2{s}^{2}+4s+5}\\ {e}^{-0.6s}\frac{5}{{s}^{4}+2{s}^{3}+{s}^{2}+s}\end{array}\right]$

Use 100 frequency points, ranging from 0.01 rad/s to 100 rad/s, to obtain the frequency response data.

```G = tf({[1 2],[5]},{[1 2 4 5],[1 2 1 1 0]},0,'ioDelay',[4 .6]); data = frd(G,logspace(-2,2,100));```

`data` is an `frd` object containing the continuous-time frequency response for `G`.

Estimate a transfer function for `data`.

```np = [3 4]; nz = [1 0]; iodelay = [4 .6]; sys = tfest(data,np,nz,iodelay);```

`np` specifies the number of poles in the estimated transfer function. The first element of `np` indicates that the transfer function from the first input to the output contains 3 poles. Similarly, the second element of `np` indicates that the transfer function from the second input to the output contains 4 poles.

`nz` specifies the number of zeros in the estimated transfer function. The first element of `nz` indicates that the transfer function from the first input to the output contains 1 zero. Similarly, the second element of `np` indicates that the transfer function from the second input to the output does not contain any zeros.

`iodelay` specifies the transport delay from the first input to the output as 4 seconds. The transport delay from the second input to the output is specified as 0.6 seconds.

`sys` is an `idtf` model containing the estimated transfer function.

### Estimate Transfer Function for Unstable System

Estimate a transfer function describing an unstable system for given data.

This example requires a Control System Toolbox license.

Obtain frequency response data.

For example, use `frd` to frequency response data model for the following system:

$G=\left[\begin{array}{c}\frac{s+2}{{s}^{3}+2{s}^{2}+4s+5}\\ \frac{5}{{s}^{4}+2{s}^{3}+{s}^{2}+s+1}\end{array}\right]$

Use 100 frequency points, ranging from 0.01 rad/s to 100 rad/s, to obtain the frequency response data.

```G = tf({[1 2],[5]},{[1 2 4 5],[1 2 1 1 1]}); data = frd(G,logspace(-2,2,100));```

`data` is an `frd` object containing the continuous-time frequency response for `G`.

Create estimation options set.

`opt = tfestOptions('Focus','prediction');`

Estimate a transfer function for `data`, using the options set `opt`.

```np = [3 4]; nz = [1 0]; sys = tfest(data,np,nz,opt);```

`np` specifies the number of poles in the estimated transfer function. The first element of `np` indicates that the transfer function from the first input to the output contains 3 poles. Similarly, the second element of `np` indicates that the transfer function from the second input to the output contains 4 poles.

`nz` specifies the number of zeros in the estimated transfer function. The first element of `nz` indicates that the transfer function from the first input to the output contains 1 zero. Similarly, the second element of `np` indicates that the transfer function from the second input to the output does not contain any zeros.

`opt` specifies the estimation options for estimating the transfer function.

`sys` is an `idtf` model containing the estimated transfer function.

collapse all

### Algorithms

`tfest` uses the prediction error minimization (PEM) approach to estimate transfer function coefficients. In general, the estimating algorithm performs two major tasks:

1. Initializing the estimable parameters.

2. Updating the estimable parameters.

The details of the algorithms used to perform these tasks vary depending on a variety of factors, including the sampling of the estimated model and the estimation data.

### Continuous-Time Transfer Function Estimation Using Time-Domain Data

#### Parameter Initialization

The estimation algorithm initializes the estimable parameters using the method specified by the `InitMethod` estimation option. The default method is the Instrument Variable (IV) method.

The State-Variable Filters (SVF) approach and the Generalized Poisson Moment Functions (GPMF) approach to continuous-time parameter estimation use prefiltered data [1] [2]. The constant $\frac{1}{\lambda }$ in [1] and [2] corresponds to the initialization option (`InitOption`) field `FilterTimeConstant`. IV is the simplified refined IV method and is called SRIVC in [3]. This method has a prefilter that is the denominator of the current model, initialized with SVF. This prefilter is iterated up to `MaxIter` times, until the model change is less than `Tolerance`. `MaxIter` and `Tolerance` are options that you can specify using the `InitOption` structure. The `'n4sid'` initialization option estimates a discrete-time model, using the N4SID estimation algorithm, that it transforms to continuous-time using `d2c`.

You use `tfestOptions` to create the option set used to estimate a transfer function.

#### Parameter Update

The initialized parameters are updated using a nonlinear least-squares search method, specified by the `SearchMethod` estimation option. The objective of the search method is to minimize the weighted prediction error norm.

### Discrete-Time Transfer Function Estimation

For discrete-time data, `tfest` uses the same algorithm as `oe` to determine the numerator and denominator polynomial coefficients. In this algorithm, the initialization is performed using `arx`, followed by nonlinear least-squares search based updates to minimize a weighted prediction error norm.

### Continuous-Time Transfer Function Estimation Using Frequency-Domain Data

For continuous-time data and fixed delays, the Output-Error algorithm is used. For continuous-time data and free delays, or for discrete-time data, the state-space estimation algorithm is used. In this algorithm, the model coefficients are initialized using the N4SID estimation method. This initialization is followed by nonlinear least-squares search based updates to minimize a weighted prediction error norm.

### Delay Estimation

• When delay values are specified as `NaN`, they are estimated separate from the model's numerator and denominator coefficients, using `delayest`. The delay values thus determined are treated as fixed values during the iterative update of the model using a nonlinear least-squares search method. Thus, the delay values are not iteratively updated. The only exception is the estimation of continuous-time models using continuous-time data.

• For an initial model, `init_sys`, with:

• `init_sys.Structure.ioDelay.Value` specified as finite values

• `init_sys.Structure.ioDelay.Free` specified as `true`

the transport delay values are updated during estimation only if you are using continuous-time, frequency-domain data and `init_sys.Ts` is zero. In all other cases, the initial delay values are left unchanged.

Estimation of delays is often a difficult problem. You should assess the presence and the value of a delay. To do so, use physical insight of the process being modeled and functions such as `arxstruc`, `delayest`, and `impulseest`. For an example of determining input delay, see Model Structure Selection: Determining Model Order and Input DelayModel Structure Selection: Determining Model Order and Input Delay.

## References

[1] Garnier, H., M. Mensler, and A. Richard. "Continuous-time Model Identification From Sampled Data: Implementation Issues and Performance Evaluation." International Journal of Control, 2003, Vol. 76, Issue 13, pp 1337–1357.

[2] Ljung, L. "Experiments With Identification of Continuous-Time Models." Proceedings of the 15th IFAC Symposium on System Identification. 2009.

[3] Young, P. C. and A.J. Jakeman. "Refined instrumental variable methods of time-series analysis: Part III, extensions." International Journal of Control 31, 1980, pp 741–764.