# Discrete Transfer Function Estimator

Compute estimate of frequency-domain transfer function of system

## Library

Estimation / Power Spectrum Estimation

`dspspect3`

• ## Description

The Discrete Transfer Function Estimator block estimates the frequency-domain transfer function of a system using the Welch’s method of averaged modified periodograms.

The block takes two inputs, x and y. x is the system input signal and y is the system output signal. x and y must have the same dimensions. For 2D inputs, the block treats each column as an independent channel. The first dimension is the length of the channel. The second dimension is the number of channels. The block treats 1D inputs as one channel. The sample rate of the block is equal to 1/T. T is the sample time of the inputs to the block.

The block buffers the input data into overlapping segments. You can set the length of the data segment and the amount of data overlap through the parameters set in the block dialog box.

The block first applies a window function to the two inputs, x and y, and then scales them by the window power. It takes the FFT of each signal, calling them X and Y. The block calculates Pxx which is the square magnitude of the FFT, X. The block then calculates Pyx which is X multiplied by the conjugate of Y. The output transfer function estimate, H, is calculated by dividing Pyx by Pxx.

## Parameters

Window length source

Source of the window length value. You can set this parameter to:

• `Same as input frame length` (default) — Window length is set to the frame size of the input.

• `Specify on dialog` — Window length is the value specified in Window length.

This parameter is nontunable.

Window length

Length of the window, in samples, used to compute the spectrum estimate, specified as a positive integer scalar greater than `2`. This parameter applies when you set Window length source to `Specify on dialog`. The default is `1024`. This parameter is nontunable.

Window Overlap (%)

Percentage of overlap between successive data windows, specified as a scalar in the range [`0,100`). The default is `0`. This parameter is nontunable.

Averaging method

Specify the averaging method as `Running` or `Exponential`. In the running averaging method, the block computes an equally weighted average of specified number of spectrum estimates defined by Number of spectral averages parameter. In the exponential method, the block computes the average over samples weighted by an exponentially decaying forgetting factor.

Number of spectral averages

Specify the number of spectral averages. The Transfer Function Estimator block computes the current estimate by averaging the last N estimates. N is the number of spectral averages. It can be any positive integer scalar, and the default is `1`.

This parameter applies when Averaging method is set to `Running`.

Specify forgetting factor from input port

Select this check box to specify the forgetting factor from an input port. When you do not select this check box, the forgetting factor is specified through the Forgetting factor parameter.

This parameter applies when Averaging method is set to `Exponential`.

Forgetting factor

Specify the exponential weighting forgetting factor as a scalar value greater than zero and smaller than or equal to one. The default is `0.9`.

This parameter applies when you set Averaging method to `Exponential` and clear the Specify forgetting factor from input port parameter.

FFT length source

Specify the source of the FFT length value. It can be one of `Auto` (default) or `Property`. When the source of the FFT length is set to `Auto`, the Transfer Function Estimator block sets the FFT length to the input frame size. When the source of the FFT length is set to `Property`, you specify the FFT length in the FFT length parameter.

FFT length

Specify the length of the FFT that the Transfer Function Estimator block uses to compute spectral estimates. It can be any positive integer scalar, and the default is 128.

Window function

Specify a window function for the Transfer Function Estimator block. Possible values are:

• `Hann` (default)

• `Rectangular`

• `Chebyshev`

• `Flat Top`

• `Hamming`

• `Kaiser`

Sidelobe attenuation of window (dB)

Specify the sidelobe attenuation of the window. It can be any real positive scalar value in decibels (dB). The default is `60`.

Note

This parameter is visible only when Window function is set to `Kaiser` or `Chebyshev`.

Frequency range

Specify the frequency range of the transfer function estimate.

• `centered` (default)

When you set the frequency range to `centered`, the Transfer Function Estimator block computes the centered two-sided transfer function of the real or complex input signals, x and y.

• `onesided`

When you set the frequency range to `onesided`, the Transfer Function Estimator block computes the one-sided transfer function of real input signals, x and y.

• `twosided`

When you set the frequency range to `twosided`, the Transfer Function Estimator block computes the two-sided transfer function of the real or complex input signals, x and y.

Output magnitude squared coherence estimate

Select this check box to compute and output the magnitude squared coherence estimate using Welch’s averaged, modified periodogram method. The magnitude squared coherence estimate indicates how well two inputs correspond to each other at each frequency.

Simulate using

Type of simulation to run. You can set this parameter to:

• `Code generation` (default)

Simulate model using generated C code. The first time you run a simulation, Simulink® generates C code for the block. The C code is reused for subsequent simulations, as long as the model does not change. This option requires additional startup time but provides faster simulation speed than ```Interpreted execution```.

• `Interpreted execution`

Simulate model using the MATLAB®  interpreter. This option shortens startup time but has slower simulation speed than ```Code generation```.

## Supported Data Types

The Discrete Transfer Function Estimator block supports real and complex inputs.

PortSupported Data Type

x

• Double-precision floating point

• Single-precision floating point

y

• Double-precision floating point

• Single-precision floating point

Output, H

• Double-precision floating point

• Single-precision floating point

## Examples

This example shows how to use the Discrete Transfer Function Estimator block to estimate the frequency-domain transfer function of a system.

The Random Source block represents the system input signal. The sample rate of the system input is 44.1 KHz. The Random Source input passes through a low-pass filter with a normalized cutoff frequency of 0.3. The filtered signal represents the system output signal. Because the Discrete Transfer Function Estimator block outputs complex values, take the magnitude of the output to see a plot of the transfer function estimate.

To view this example, execute `ex_discrete_transfer_function_estimator` in MATLAB Command prompt. The transfer function plot displays the system transfer function, a low-pass filter that matches the frequency response of the Discrete FIR Filter block. expand all

## Extended Capabilities

### C/C++ Code GenerationGenerate C and C++ code using Simulink® Coder™. 