# tunableTF

Tunable transfer function with fixed number of poles and zeros

## Syntax

```blk = tunableTF(name,Nz,Np) blk = tunableTF(name,Nz,Np,Ts) blk = tunableTF(name,sys) ```

## Description

Model object for creating tunable SISO transfer function models of fixed order. `tunableTF` lets you parameterize a transfer function of a given order for parameter studies or for automatic tuning with tuning commands such as `systune` or `looptune`.

`tunableTF` is part of the Control Design Block family of parametric models. Other Control Design Blocks include `tunablePID`, `tunableSS`, and `tunableGain`.

## Construction

`blk = tunableTF(name,Nz,Np)` creates the parametric SISO transfer function:

`$blk=\frac{{a}_{m}{s}^{m}+{a}_{m-1}{s}^{m-1}+\dots +{a}_{1}s+{a}_{0}}{{s}^{n}+{b}_{n-1}{s}^{n-1}+\dots +{b}_{1}s+{b}_{0}}.$`

`n = ``Np` is the maximum number of poles of `blk`, and `m = ``Nz` is the maximum number of zeros. The tunable parameters are the numerator and denominator coefficients a0, ..., am and b0, ..., bn–1. The leading coefficient of the denominator is fixed to 1.

`blk = tunableTF(name,Nz,Np,Ts)` creates a discrete-time parametric transfer function with sample time `Ts`.

`blk = tunableTF(name,sys)` uses the `tf` model `sys` to set the number of poles, number of zeros, sample time, and initial parameter values.

### Input Arguments

 `name` Parametric transfer function `Name`, specified as a character vector such as `'filt'` or `'DM'`. (See Properties.) `Nz` Nonnegative integer specifying the number of zeros of the parametric transfer function `blk`. `Np` Nonnegative integer specifying the number of poles of the parametric transfer function `blk`. `Ts` Scalar sample time. `sys` `tf` model providing number of poles, number of zeros, sample time, and initial values of the parameters of `blk`.

## Properties

`Numerator, Denominator`

Parameterization of the numerator coefficients am, ..., a0 and the denominator coefficients 1,bn–1, ..., b0 of the tunable transfer function `blk`.

`blk.Numerator` and `blk.Denominator` are `param.Continuous` objects. For general information about the properties of these `param.Continuous` objects, see the `param.Continuous` (Simulink Design Optimization) object reference page.

The following fields of `blk.Numerator` and `blk.Denominator` are used when you tune `blk` using `hinfstruct`:

FieldDescription
`Value`

Array of current values of the numerator am, ..., a0 or the denominator coefficients 1,bn–1, ..., b0. `blk.Numerator.Value` has length `Nz + 1`. `blk.Denominator.Value` has length ```Np + 1```. The leading coefficient of the denominator (`blk.Denominator.Value(1)`) is always fixed to 1.

By default, the coefficients initialize to values that yield a stable, strictly proper transfer function. Use the input `sys` to initialize the coefficients to different values.

`hinfstruct` (Robust Control Toolbox) tunes all values except those whose `Free` field is zero.

`Free`

Array of logical values determining whether the coefficients are fixed or tunable. For example:

• If `blk.Numerator.Free(j) = 1`, then `blk.Numerator.Value(j)` is tunable.

• If `blk.Numerator.Free(j) = 0`, then `blk.Numerator.Value(j)` is fixed.

Default: `blk.Denominator.Free(1) = 0`; all other entries are 1.

`Minimum`

Minimum value of the parameter. This property places a lower bound on the tuned value of the parameter. For example, setting `blk.Numerator.Minimum(1) = 0` ensures that the leading coefficient of the numerator remains positive.

Default: `-Inf`

`Maximum`

Maximum value of the parameter. This property places an upper bound on the tuned value of the parameter. For example, setting `blk.Numerator.Maximum(1) = 1` ensures that the leading coefficient of the numerator does not exceed 1.

Default: `Inf`

`Ts`

Sample 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 sample time, set ```Ts = -1```.

Changing this property does not discretize or resample the model.

Default: `0` (continuous time)

`TimeUnit`

Units for the time variable, the sample time `Ts`, and any time delays in the model, specified as one of the following values:

• `'nanoseconds'`

• `'microseconds'`

• `'milliseconds'`

• `'seconds'`

• `'minutes'`

• `'hours'`

• `'days'`

• `'weeks'`

• `'months'`

• `'years'`

Changing this property has no effect on other properties, and therefore changes the overall system behavior. Use `chgTimeUnit` to convert between time units without modifying system behavior.

Default: `'seconds'`

`InputName`

Input channel names, specified as one of the following:

• Character vector — For single-input models, for example, `'controls'`.

• Cell array of character vectors — For multi-input models.

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)'}`.

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: `''` for all input channels

`InputUnit`

Input channel units, specified as one of the following:

• Character vector — For single-input models, for example, `'seconds'`.

• Cell array of character vectors — For multi-input models.

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

Default: `''` 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, specified as one of the following:

• Character vector — For single-output models. For example, `'measurements'`.

• Cell array of character vectors — For multi-output models.

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)'}`.

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: `''` for all output channels

`OutputUnit`

Output channel units, specified as one of the following:

• Character vector — For single-output models. For example, `'seconds'`.

• Cell array of character vectors — For multi-output models.

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

Default: `''` for all output 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 = ; sys.OutputGroup.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, specified as a character vector. For example, `'system_1'`.

Default: `''`

`Notes`

Any text that you want to associate with the system, stored 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.' ```

Default: `[0×1 string]`

`UserData`

Any type of data you want to associate with system, specified as any MATLAB® data type.

Default: `[]`

## Examples

Create a parametric SISO transfer function with two zeros, four poles, and at least one integrator.

A transfer function with an integrator includes a factor of 1/s. Therefore, to ensure that a parameterized transfer function has at least one integrator regardless of the parameter values, fix the lowest-order coefficient of the denominator to zero.

``` blk = tunableTF('tfblock',2,4); % two zeros, four poles blk.Denominator.Value(end) = 0; % set last denominator entry to zero blk.Denominator.Free(end) = 0; % fix it to zero```

Create a parametric transfer function, and assign names to the input and output.

```blk = tunableTF('tfblock',2,3); blk.InputName = {'error'}; % assign input name blk.OutputName = {'control'}; % assign output name```

## Version History

Introduced in R2016a

expand all