# Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English verison of the page.

# dsp.TransferFunctionEstimator System object

Package: dsp

Estimate transfer function

## Description

The `dsp.TransferFunctionEstimator` computes the transfer function of a system, using the Welch algorithm and the Periodogram method.

To implement the transfer function estimation object:

1. Define and set up your transfer function estimator object. See Construction.

2. Call `step` to implement the estimator according to the properties of `dsp.TransferFunctionEstimator`. The behavior of `step` is specific to each object in the toolbox.

 Note:   Starting in R2016b, instead of using the `step` method to perform the operation defined by the System object™, you can call the object with arguments, as if it were a function. For example, ```y = step(obj,x)``` and `y = obj(x)` perform equivalent operations.

## Construction

`tfe = dsp.TransferFunctionEstimator` returns a System object, `tfe`, that computes the transfer function of real or complex signals. This System object uses the periodogram method and Welch's averaged, modified periodogram method.

`tfe = dsp.TransferFunctionEstimator('PropertyName', PropertyValue,...)` returns a `Transfer Function Estimator` System object, `tfe`, with each specified property set to the specified value. You can specify additional name-value pair arguments in any order as (Name1,Value1,...,NameN,ValueN).

## Properties

 `SpectralAverages` Number of spectral averages Specify the number of spectral averages as a positive, integer scalar. The Transfer Function Estimator computes the current estimate by averaging the last `N` estimates. `N` is the number of spectral averages defined in the `SpectralAverages` property. The default value is `8`. `FFTLengthSource` Source of the FFT length value Specify the source of the FFT length value as one of `'Auto'` | `'Property'`. The default value is `'Auto'`. If you set this property to `'Auto'`, the Transfer function Estimator sets the FFT length to the input frame size. If you set this property to `'Property'`, then you specify the number of FFT points using the `FFTLength` property. `FFTLength` FFT Length Specify the length of the FFT that the Transfer Function Estimator uses to compute spectral estimates as a positive, integer scalar. This property applies when you set the `FFTLengthSource` property to `'Property'`. The default value is `128`. `Window` Window function Specify a window function for the Transfer Function estimator as one of `'Rectangular'` | `'Chebyshev'` |``` 'Flat Top'``` | `'Hamming'` | `'Hann'` | `'Kaiser'`. The default value is `'Hann'`. `SidelobeAttenuation` Side lobe attenuation of window Specify the side lobe attenuation of the window as a real, positive scalar, in decibels (dB). This property applies when you set the `Window` property to `'Chebyshev'` or `'Kaiser'`. The default value is `60 dB`. `FrequencyRange` Frequency range of the transfer function estimate Specify the frequency range of the transfer function estimator as one of `'twosided'` | `'onesided'` | `'centered'`. If you set the `FrequencyRange` to `'onesided'`, the transfer function estimator computes the onesided transfer function of real input signals, `x` and `y`. If the FFT length, NFFT, is even, the length of the transfer function estimate is `NFFT/2+1` and is computed over the interval `[0,SampleRate/2]`. If NFFT is odd, the length of the transfer function estimate is equal to `(NFFT+1)/2` and the interval is `[0,SampleRate/2]`. If `FrequencyRange` is set to `'twosided'`, the transfer function estimator computes the twosided transfer function of complex or real input signals, `x` and `y`. The length of the transfer function estimate is equal to NFFT and is computed over `[0, SampleRate]`. If you set the `FrequencyRange` to `'centered'`, the transfer function estimator computes the centered twosided transfer function of complex or real input signals, `x` and `y`. The length of the transfer function estimate is equal to NFFT and it is computed over `[-SampleRate/2, SampleRate/2]` for even lengths, and `[-SampleRate/2, SampleRate/2]` for odd lengths. The default value is `'Twosided'`. `OutputCoherence` Magnitude squared coherence estimate Specify `true` to compute and output the magnitude squared coherence estimate using Welch's averaged, modified periodogram method. The magnitude squared coherence estimate has values between 0 and 1 that indicate the correspondence at each frequency between two input signals. If you specify `false`, the magnitude squared coherence estimate is not computed. The default value is `false`.

## Methods

 getFrequencyVector Get vector of frequencies at which transfer function is estimated getRBW Get resolution bandwidth of transfer function reset Reset internal states of transfer function estimator step Estimate transfer function of system
Common to All System Objects
`clone`

Create System object with same property values

`getNumInputs`

Expected number of inputs to a System object

`getNumOutputs`

Expected number of outputs of a System object

`isLocked`

Check locked states of a System object (logical)

`release`

Allow System object property value changes

## Examples

expand all

Note: This example runs only in R2016b or later. If you are using an earlier release, replace each call to the function with the equivalent `step` syntax. For example, myObject(x) becomes step(myObject,x).

Generate a sine wave. Use the dsp.TransferFunctionEstimator System object to estimate the system transfer function, and the dsp.ArrayPlot System object to display it.

```sin = dsp.SineWave('Frequency',100, 'SampleRate', 1000); sin.SamplesPerFrame = 1000; tfe = dsp.TransferFunctionEstimator('FrequencyRange','centered'); aplot = dsp.ArrayPlot('PlotType','Line','XOffset',-500,'YLimits',... [-120 5],'YLabel','Frequency Response (dB)',... 'XLabel','Frequency (Hz)',... 'Title','System Transfer Function'); ```

Create an FIR Filter System object of order 64 and (normalized) cutoff frequency of 1/4. Add random noise to the sine wave. Step through the System objects to obtain the data streams, and plot the log of the magnitude of the transfer function.

```firFilt = dsp.FIRFilter('Numerator',fir1(64,1/4)); for ii = 1:100 x = sin() + 0.05*randn(1000,1); y = firFilt(x); Txy = tfe(x,y); aplot(20*log10(abs(Txy))) end ```

## Algorithms

Given two signals `x` and `y` as inputs. We first window the two inputs, and scale them by the window power. We then take FFT of the signals, calling them `X` and `Y`. This is followed by calculating `Pxx` which is the square magnitude of the FFT, `X`, and `Pyx` which is `X` multiplied by the conjugate of `Y`. The transfer function estimate is calculated by dividing `Pyx` by `Pxx`.

For further information refer to the Algorithms section in Spectrum Analyzer, which uses the same algorithm.

The magnitude squared coherence, `Cxy`, is defined as

`${C}_{xy}=\frac{\left(abs\left({P}_{xy}\right).^2\right)}{\left(P{}_{xx}.*{P}_{yy}\right)}$`

where, `x` and `y` are input signals. `Pxx` and `Pyy` are the power spectral density (PSD) estimates of `x` and `y`, respectively. Pxy is the cross power spectral density (CPSD) estimate of `x` and `y`.

## References

[1] Hayes, Monson H. Statistical Digital Signal Processing and Modeling. Hoboken, NJ: John Wiley & Sons, 1996

[2] Kay, Steven M. Modern Spectral Estimation: Theory and Application. Englewood Cliffs, NJ: Prentice Hall, 1999

[3] Stoica, Petre and Randolph L. Moses. Spectral Analysis of Signals. Englewood Cliffs, NJ: Prentice Hall, 2005

[4] Welch, P. D. ``The use of fast Fourier transforms for the estimation of power spectra: A method based on time averaging over short modified periodograms,'' IEEE Transactions on Audio and Electroacoustics, Vol. 15, pp. 70–73, 1967.