Discrete TF
DiscreteThe DiscreteTransferFunction block implements an arbitrary linear discrete-time transfer function in the complex -domain using the numerically robust Direct Form II Transposed structure. Polynomial coefficients are specified as space-separated floating-point values arranged in descending powers of .
The block also provides an optional reset port to instantly restore internal filter delay states to zero or a designated initial condition during simulation runtime.
Mathematical Model
The pulse transfer function is defined in descending powers of the complex variable :
where ensures causality. In the time domain, Direct Form II Transposed maintains internal delay states ():
Inputs & Outputs
| Direction | ID | Label | Type | Status |
|---|---|---|---|---|
| → In | in |
In | number | Required |
| → In | reset |
Reset | number | Optional |
| ← Out | out |
Out | number | Output |
Parameters
| Parameters | Label | Type | Default | Description |
|---|---|---|---|---|
numerator |
Numerator B(z) | polynomial | 1 |
|
denominator |
Denominator A(z) | polynomial | 1 -0.5 |
|
sampleTime |
Sample Time | number | 0.01 |
|
initialCondition |
Initial Condition | number | 0 |
Usage Examples
Example 1: First-Order Discrete Lowpass Filter
Implementing a discrete single-pole lowpass filter with pulse transfer function . Specifying numerator = "0.1 0" and denominator = "1 -0.9" with sampleTime = 0.01 s provides smooth exponential smoothing of noisy sensor signals without numerical drift.
Example 2: Two-Point Moving Average FIR Filter
Constructing a Finite Impulse Response (FIR) filter computing the average of the current and preceding sample: , corresponding to . Setting numerator = "0.5 0.5" and denominator = "1 0" yields an unconditionally stable FIR filter with a notch zero at the Nyquist frequency.
Remarks & Best Practices
- Causality Requirement: The order of the numerator polynomial must not exceed that of the denominator polynomial (); strictly non-causal systems cannot be evaluated in real time.
- Descending Powers Convention: Explicitly include intermediate zero coefficients; for example, must be entered as
"1 0 1". - Direct Form II Transposed Structure: This realization minimizes sensitivity to coefficient quantization and avoids internal state overflow compared to Direct Form I.
- BIBO Stability: The transfer function is bounded-input bounded-output (BIBO) stable if and only if all roots of lie strictly inside the unit circle of the complex -plane ().
- Runtime Reset Capability: Applying a positive signal to the optional
resetport instantly clears internal delay registers, facilitating rapid controller re-initialization.
Related Components
- TransferFunction: Continuous-time Laplace transfer function .
- DiscreteStateSpace: Discrete-time linear system in matrix state-space form.
- DigitalFilter: Pre-configured IIR/FIR filter block with automatic Butterworth, Chebyshev, and Bessel coefficient calculation.
- UnitDelay: Fundamental single-sample discrete delay element ().