Main Content

dsp.TransferFunctionEstimator

Estimate transfer function

Description

The dsp.TransferFunctionEstimator System object™ computes the transfer function of a system, using the Welch's averaged periodogram method.

To implement the transfer function estimation object:

  1. Create the dsp.TransferFunctionEstimator object and set its properties.

  2. Call the object with arguments, as if it were a function.

To learn more about how System objects work, see What Are System Objects?

Creation

Description

tfe = dsp.TransferFunctionEstimator returns a transfer function estimator object, 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(Name,Value) returns a transfer function estimator object with each specified property set to the specified value. Unspecified properties have default values.

example

Properties

expand all

Unless otherwise indicated, properties are nontunable, which means you cannot change their values after calling the object. Objects lock when you call them, and the release function unlocks them.

If a property is tunable, you can change its value at any time.

For more information on changing property values, see System Design in MATLAB Using System Objects.

Specify the source of the FFT length value as either 'Auto' or 'Property'. 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 specify the number of FFT points using the FFTLength property.

Specify the length of the FFT that the transfer function estimator uses to compute spectral estimates as a positive, integer scalar.

Dependencies

This property applies when you set the FFTLengthSource property to 'Property'.

Data Types: double

Specify a window function for the transfer function estimator as one of 'Rectangular', 'Chebyshev', 'Flat Top', 'Hamming', 'Hann', or 'Kaiser'.

Specify the side lobe attenuation of the window as a real, positive scalar, in decibels (dB).

Dependencies

This property applies when you set the Window property to 'Chebyshev' or 'Kaiser'.

Data Types: double

Specify the frequency range of the transfer function estimator as one of 'twosided', 'onesided', or 'centered'.

If you set the FrequencyRange to 'onesided', the transfer function estimator computes the one-sided 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 two-sided 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 two-sided 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.

Specify the averaging method as 'Running' or 'Exponential'. In the running averaging method, the object computes an equally weighted average of a specified number of spectrum estimates defined by the SpectralAverages property. In the exponential method, the object computes the average over samples weighted by an exponentially decaying forgetting factor.

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, where N is the number of spectral averages defined in the SpectralAverages property.

Dependencies

This property applies when you set AveragingMethod to 'Running'.

Data Types: double

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

Tunable: Yes

Dependencies

This property applies when you set AveragingMethod to 'Exponential'.

Data Types: single | double

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.

Usage

Description

tfeEst = tfe(x,y) computes the transfer function estimate, tfeEst, of the system with input x and output y using Welch's averaged periodogram method.

example

[tfeEst,cxy] = tfe(x,y) also computes the magnitude squared coherence estimate, cxy, of the system.

Input Arguments

expand all

First data input, specified as a vector or a matrix. x and y must have the same size and data type.

Data Types: single | double
Complex Number Support: Yes

Second data input, specified as a vector or a matrix. x and y must have the same size and data type.

Data Types: single | double
Complex Number Support: Yes

Output Arguments

expand all

Transfer function estimate of the system for which x and y are the input and output signals, respectively.

The estimate, tfeEst, is equal to pxy./pxx, where pxy is the cross-power spectral density of x and y, and pxx is the power spectral density of x.

The transfer function estimate has the same size and data type as the input.

Data Types: single | double
Complex Number Support: Yes

Magnitude squared coherence estimate of the system, returned as a vector or a matrix.

The coherence estimate, cxy, is equal to (abs(pxy).^2)./(pxx.*pyy), where pxy is the cross power spectral density of x and y, pxx is the power spectral density of x, and pyy is the power spectral density of y. For coherence to be estimated, the OutputCoherence property must be set to true.

The coherence estimate has the same size and data type as the input.

Data Types: single | double

Object Functions

To use an object function, specify the System object as the first input argument. For example, to release system resources of a System object named obj, use this syntax:

release(obj)

expand all

getFrequencyVectorVector of frequencies at which estimation is done
getRBWResolution bandwidth of spectrum
stepRun System object algorithm
releaseRelease resources and allow changes to System object property values and input characteristics
resetReset internal states of System object

Examples

collapse all

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',designLowpassFIR(FilterOrder=64,...
    CutoffFrequency=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

expand all

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.

Extended Capabilities

Version History

Introduced in R2013b