Signal Processing Toolbox |
Estimate the transfer function from input and output
Syntax
Txy=
tfe(x,y) Txy=
tfe(x,y,nfft) [Txy,f]=
tfe(x,y,nfft,fs) Txy=
tfe(x,y,nfft,fs,window) Txy=
tfe(x,y,nfft,fs,window,numoverlap) Txy=
tfe(x,y,...,'dflag
') tfe(x,y)
Description
finds a transfer function estimate Txy = tfe(x,y)
Txy
given input signal vector x
and output signal vector y
. The transfer function is the quotient of the cross spectrum of x
and y
and the power spectrum of x
.
The relationship between the input x
and output y
is modeled by the linear, time-invariant transfer function Txy
.
Vectors x
and y
must be the same length. Txy = tfe(x,y)
uses the following default values:
nfft = min(256,(length(x))
fs = 2
window
is a periodic Hann (Hanning) window of length nfft
numoverlap = 0
nfft
specifies the FFT length that tfe
uses. This value determines the frequencies at which the power spectrum is estimated. fs
is a scalar that specifies the sampling frequency. window
specifies a windowing function and the number of samples tfe
uses in its sectioning of the x
and y
vectors. numoverlap
is the number of samples by which the sections overlap. Any arguments that are omitted from the end of the parameter list use the default values shown above.
If x
is real, tfe
estimates the transfer function at positive frequencies only; in this case, the output Txy
is a column vector of length nfft/2+1
for nfft
even and (nfft+1)/2
for nfft
odd. If x
or y
is complex, tfe
estimates the transfer function for both positive and negative frequencies and Txy
has length nfft
.
Txy
uses the specified FFT length =
tfe(x,y,nfft)
nfft
in estimating the transfer function.
returns a vector [Txy,f] = tfe(x,y,nfft,fs)
f
of frequencies at which tfe
estimates the transfer function. fs
is the sampling frequency. f
is the same size as Txy
, so plot(f,Txy
) plots the transfer function estimate versus properly scaled frequency. fs
has no effect on the output Txy
; it is a frequency scaling multiplier.
Txy
specifies a windowing function and the number of samples per section of the =
tfe(x,y,nfft,fs,window)
x
vector. If you supply a scalar for window
, Txy
uses a Hann window of that length. The length of the window must be less than or equal to nfft
; tfe
zero pads the sections if the length of the window exceeds nfft
.
Txy
overlaps the sections of =
tfe(x,y,nfft,fs,window,numoverlap)
x
by numoverlap
samples.
You can use the empty matrix []
to specify the default value for any input argument except x
or y
. For example,
uses 256 as the value for nfft
and 2 as the value for fs
.
Txy
specifies a detrend option, where =
tfe(x,y,...,'dflag
')
'
dflag
'
is
'linear'
, to remove the best straight-line fit from the prewindowed sections of x
and y
'mean'
, to remove the mean from the prewindowed sections of x
and y
'none'
, for no detrending (default)
The '
dflag
'
parameter must appear last in the list of input arguments. tfe
recognizes a '
dflag
'
string no matter how many intermediate arguments are omitted.
tfe(...)
with no output arguments plots the magnitude of the transfer function estimate as decibels versus frequency in the current figure window.
Examples
Compute and plot the transfer function estimate between two colored noise sequences x
and y
:
h=
fir1(30,0.2,rectwin(31)); x=
randn(16384,1); y=
filter(h,1,x); tfe(x,y,1024,[],[],512) title('Transfer Function Estimate')
Algorithm
tfe
uses a four-step algorithm:
window
.
nfft
FFT of each section.
x
sections to form Pxx
and averages the products of the spectra of the x
and y
sections to form Pxy
.
Txy
:
Diagnostics
An appropriate diagnostic message is displayed when incorrect arguments are used:
Requires window's length to be no greater than the FFT length. Requires NOVERLAP to be strictly less than the window length. Requires positive integer values for NFFT and NOVERLAP. Requires vector (either row or column) input. Requires inputs X and Y to have the same length.
See Also
etfe, cohere
, csd
, pwelch
, spa
tf2zpk | triang |