Package: dsp
Estimate transfer function
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:
Define and set up your transfer function estimator object. See Construction.
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.
H = dsp.TransferFunctionEstimator
returns
a System object™, H, that computes the transfer function of real
or complex signals. This System object uses the periodogram method
and Welch's averaged, modified periodogram method.
H = dsp.TransferFunctionEstimator('
returns
a PropertyName
', PropertyValue
,...)Transfer Function Estimator
System object,
H, with each specified property set to the specified value. You can
specify additional namevalue pair arguments in any order as (Name1,Value1,...,NameN,ValueN).

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 

Source of the FFT length value Specify the source of the FFT length value as one of 

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 

Window function Specify a window function for the Transfer Function estimator
as one of 

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 

Frequency range of the transfer function estimate Specify the frequency range of the transfer function estimator
as one of If you set the If If you set the 

Magnitude squared coherence estimate Specify 
clone  Create Transfer Function estimator object with same property values 
getFrequencyVector  Get vector of frequencies at which transfer function is estimated 
getRBW  Get resolution bandwidth of transfer function 
isLocked  Locked status for input attributes and nontunable properties 
release  Allow property value and input characteristics to change 
reset  Reset internal states of transfer function estimator 
step  Estimate transfer function of system 
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.
hsin = dsp.SineWave('Frequency',100, 'SampleRate', 1000); hsin.SamplesPerFrame = 1000; hs = dsp.TransferFunctionEstimator('FrequencyRange','centered'); hplot = 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.
hfilt = dsp.FIRFilter('Numerator',fir1(64,1/4)); for ii = 1:100 x = step(hsin) + 0.05*randn(1000,1); y = step(hfilt,x); Txy = step(hs,x,y); step(hplot,20*log10(abs(Txy))) end
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 P_{xx}
which
is the square magnitude of the FFT, X
, and P_{yx}
which
is X
multiplied by the conjugate of Y
.
The transfer function estimate is calculated by dividing P_{yx}
by P_{xx}
.
For further information refer to the Algorithms section in Spectrum Analyzer, which uses the same algorithm.
The magnitude squared coherence, C_{xy}
,
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. P_{xx}
and P_{yy}
are
the power spectral density (PSD) estimates of x
and y
,
respectively. P_{xy} is the cross power spectral
density (CPSD) estimate of x
and y
.
[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.