Products & Services Solutions Academia Support User Community Company

Learn more about Simulink   

Discrete Transfer Fcn - Implement discrete transfer function

Library

Discrete

Description

The Discrete Transfer Fcn block implements the z-transform transfer function:

where m+1 and n+1 are the number of numerator and denominator coefficients, respectively. num and den contain the coefficients of the numerator and denominator in descending powers of z. num can be a vector or matrix, den must be a vector, and you specify both as parameters on the block dialog box. The order of the denominator must be greater than or equal to the order of the numerator.

Specify the coefficients of the numerator and denominator polynomials in descending powers of z. The Discrete Filter block lets you use polynomials in z-1 (the delay operator) to represent a discrete system, a method that signal processing engineers typically use. Conversely, the Discrete Transfer Fcn block lets you use polynomials in z to represent a discrete system, the method that control engineers typically use. The two methods are identical when the numerator and denominator polynomials have the same length.

Specifying Initial States

Use the Initial states parameter to specify initial filter states. To determine the number of initial states you must specify and how to specify them, see the following table of valid initial state dimensions. The Initial states parameter can take one of the forms described in this table.

Valid Initial States

Initial StatesDescription

Scalar

The block initializes all filter states to the same scalar value. Enter 0 to initialize all states to zero.

Vector or matrix

Each vector or matrix element specifies a unique initial state for a corresponding delay element in a corresponding channel:

  • The vector length must equal the number of delay elements in the filter, max(number of zeros, number of poles).

  • The matrix must have the same number of rows as the number of delay elements in the filter, max(number of zeros, number of poles). The matrix must also have one column for each channel of the input signal.

The following example shows the relationship between the initial filter output and the initial input and state. Given an initial input u1, the first output y1 is related to the initial state [x1, x2] and initial input by:

Initial States: 1

Data Type Support

The Discrete Transfer Function block accepts and outputs real and complex signals of any signed numeric data type that Simulink supports. The block supports the same types for the numerator and denominator coefficients.

Numerator and denominator coefficients must have the same complexity. They can have different word lengths and fraction lengths.

States are complex when either the input or the coefficients are complex.

The following diagrams show the filter structure and the data types that the block uses for floating-point and fixed-point signals.

The block omits the dashed divide when you select the Optimize by skipping divide by leading denominator coefficient (a0) parameter.

Parameters and Dialog Box

The Main pane of the Discrete Transfer Fcn block dialog box appears as follows.

Numerator coefficients

Specify the coefficients of the discrete filter numerator polynomial or polynomials in descending powers of z. Use a row vector to specify the coefficients for a single numerator polynomial.

Denominator coefficients

Specify the coefficients of the discrete filter denominator polynomial as a row vector in descending powers of z.

Initial states

Specify the initial states of the filter states. To learn how to specify initial states, see Specifying Initial States.

Sample time

Specify the time interval between samples. To inherit the sample time, set this parameter to -1. See How to Specify the Sample Time.

Optimize by skipping divide by leading denominator coefficient (a0)

Select when the leading denominator coefficient, a0, equals one. This parameter generates optimized code.

When you select this check box, the block:

  • Does not perform a divide-by-a0 either in simulation or in the generated code

  • Errors out at model edit time if the a0 value you provide in the dialog is not one

  • Errors out if you tune a0 to any nonunity value

When you clear this check box, the block:

  • Is fully tunable during simulation

  • Performs a divide-by-a0 in both simulation and code generation

The Data Types pane of the Discrete Transfer Fcn block dialog box appears as follows.

State

Specify the state data type. You can set it to:

  • A rule that inherits a data type, for example, Inherit: Same as input

  • A built-in integer, for example, int8

  • A data type object, for example, a Simulink.NumericType object

  • An expression that evaluates to a data type, for example, fixdt(1,16,0)

Click the Show data type assistant button to display the Data Type Assistant, which helps you set the State parameter.

See Using the Data Type Assistant for more information.

Numerator coefficients

Specify the numerator coefficient data type. You can set it to:

  • A rule that inherits a data type, for example, Inherit: Inherit via internal rule

  • A built-in integer, for example, int8

  • A data type object, for example, a Simulink.NumericType object

  • An expression that evaluates to a data type, for example, fixdt(1,16,0)

Click the Show data type assistant button to display the Data Type Assistant, which helps you set the Numerator coefficients parameter.

See Using the Data Type Assistant for more information.

Numerator coefficient minimum

Specify the minimum value that a numerator coefficient can have. The default value, [], is equivalent to -Inf. Simulink software uses this value to perform:

Numerator coefficient maximum

Specify the maximum value that a numerator coefficient can have. The default value, [], is equivalent to Inf. Simulink software uses this value to perform:

Numerator product output

Specify the product output data type for the numerator coefficients. You can set it to:

  • A rule that inherits a data type, for example, Inherit: Inherit via internal rule

  • A built-in data type, for example, int8

  • A data type object, for example, a Simulink.NumericType object

  • An expression that evaluates to a data type, for example, fixdt(1,16,0)

Click the Show data type assistant button to display the Data Type Assistant, which helps you set the Numerator product output parameter.

See Using the Data Type Assistant for more information.

Numerator accumulator

Specify the accumulator data type for the numerator coefficients. You can set it to:

  • A rule that inherits a data type, for example, Inherit: Inherit via internal rule

  • A built-in data type, for example, int8

  • A data type object, for example, a Simulink.NumericType object

  • An expression that evaluates to a data type, for example, fixdt(1,16,0)

Click the Show data type assistant button to display the Data Type Assistant, which helps you set the Numerator accumulator parameter.

See Using the Data Type Assistant for more information.

Denominator coefficients

Specify the denominator coefficient data type. You can set it to:

  • A rule that inherits a data type, for example, Inherit: Inherit via internal rule

  • A built-in integer, for example, int8

  • A data type object, for example, a Simulink.NumericType object

  • An expression that evaluates to a data type, for example, fixdt(1,16,0)

Click the Show data type assistant button to display the Data Type Assistant, which helps you set the Denominator coefficients parameter.

See Using the Data Type Assistant for more information.

Denominator coefficient minimum

Specify the minimum value that a denominator coefficient can have. The default value, [], is equivalent to -Inf. Simulink software uses this value to perform:

Denominator coefficient maximum

Specify the maximum value that a denominator coefficient can have. The default value, [], is equivalent to Inf. Simulink software uses this value to perform:

Denominator product output

Specify the product output data type for the denominator coefficients. You can set it to:

  • A rule that inherits a data type, for example, Inherit: Inherit via internal rule

  • A built-in data type, for example, int8

  • A data type object, for example, a Simulink.NumericType object

  • An expression that evaluates to a data type, for example, fixdt(1,16,0)

Click the Show data type assistant button to display the Data Type Assistant, which helps you set the Denominator product output parameter.

See Using the Data Type Assistant for more information.

Denominator accumulator

Specify the accumulator data type for the denominator coefficients. You can set it to:

  • A rule that inherits a data type, for example, Inherit: Inherit via internal rule

  • A built-in data type, for example, int8

  • A data type object, for example, a Simulink.NumericType object

  • An expression that evaluates to a data type, for example, fixdt(1,16,0)

Click the Show data type assistant button to display the Data Type Assistant, which helps you set the Denominator accumulator parameter.

See Using the Data Type Assistant for more information.

Output

Specify the output data type. You can set it to:

  • A rule that inherits a data type, for example, Inherit: Inherit via internal rule

  • A built-in data type, for example, int8

  • A data type object, for example, a Simulink.NumericType object

  • An expression that evaluates to a data type, for example, fixdt(1,16,0)

Click the Show data type assistant button to display the Data Type Assistant, which helps you set the Output parameter.

See Specifying Block Output Data Types for more information.

Output minimum

Specify the minimum value that the block can output. The default value, [], is equivalent to -Inf. Simulink uses this value to perform:

Output maximum

Specify the maximum value that the block can output. The default value, [], is equivalent to Inf. Simulink uses this value to perform:

Lock data type settings against changes by the fixed-point tools

Select to lock all data type settings of this block against changes by the Fixed-Point Tool and the Fixed-Point Advisor. For more information, see Fixed-Point Tool and Fixed-Point Advisor in the Simulink Fixed Point documentation.

Integer rounding mode

Select the rounding mode for fixed-point operations. For more information, see Rounding in the Simulink Fixed Point User's Guide.

Saturate on integer overflow

Select this check box to have overflows saturate. Otherwise, they wrap.

When you select this check box, saturation applies to every internal operation on the block, not just the output or result. In general, the code generation process can detect when overflow is not possible, in which case, no saturation code is necessary.

The State Attributes pane of the Discrete Filter block dialog box appears as follows.

State name

Use this parameter to assign a unique name to each state. The default is ' '. When this field is blank, no name is assigned. Consider the following when using this parameter:

  • To assign a name to a single state, enter the name between quotes, for example, 'velocity'.

  • The state names apply only to the selected block.

  • To assign names to multiple states, enter a comma-delimited list surrounded by braces, for example, {'a', 'b', 'c'} . Each name must be unique.

  • The number of states must be an integer multiple of the number of state names. You can have fewer names than states, but you cannot have more names than states.

  • For example, you can specify two names in a system with four states. Simulink software assigns the first name to the first two states and the second name to the last two.

  • To assign state names with a variable that you have defined in the MATLAB workspace, enter the variable without quotes. A variable can be a string, cell, or structure.

This parameter enables State name must resolve to Simulink signal object when you click Apply.

State name must resolve to Simulink signal object

Select this check box to require that the state name resolves to a Simulink signal object. This check box is cleared by default.

Specifying the State name parameter enables this parameter.

Selecting this check box enables Real-Time Workshop storage class.

Real-Time Workshop storage class

From the list, select the state storage class.

Auto

If you do not need states to interface to external code, select Auto as the storage class.

ExportedGlobal

The class stores the state in a global variable.

ImportedExtern

model_private.h declares the state as an extern variable.

ImportedExternPointer

model_private.h declares the state as an extern pointer.

Specifying the State name parameter enables this parameter.

Setting this parameter to ExportedGlobal, ImportedExtern, or ImportedExternPointer enables Real-Time Workshop storage type qualifier.

During simulation, the block uses the following values:

See Block State Storage and Interfacing Considerations in the Real-Time Workshop User's Guide for more information.

Characteristics

Direct Feedthrough

Only when the leading numerator coefficient is not equal to zero and the numerator order equals the denominator order

Sample Time

Specified in the Sample time parameter

Scalar Expansion

Yes, of initial states

States

See Specifying Initial States

Dimensionalized

Yes

Zero-Crossing Detection

No

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS