You are here : matlabSignal Processingtfestimate

tfestimate() - Signal Processing

```Txy = tfestimate(x,y) finds
a transfer function estimate, Txy, given an input
signal, x, and an output signal, y.The signals may be either vectors or two-dimensional matrices.
If both are vectors, they must have the same length. If both are matrices,
they must have the same size, and tfestimate operates
columnwise: Txy(:,n) = tfestimate(x(:,n),y(:,n)).
If one is a matrix and the other is a vector, then the vector is converted
to a column vector and internally expanded so both inputs have the
same number of columns.If x is real, tfestimate 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, tfestimate estimates
the transfer function for both positive and negative frequencies and Txy has
length nfft.tfestimate uses the following default values.Default ValuesParameterDescriptionDefault Value
nfftFFT length which determines the frequencies at which
the PSD is estimatedFor real x and y,
the length of Txy is (nfft/2+1)
if nfft is even or (nfft+1)/2
if nfft is odd. For complex x or y,
the length of Txy is nfft.If nfft is
greater than the signal length, the data is zero-padded. If nfft is
less than the signal length, the data segment is wrapped so that the
length is equal to nfft.Maximum of 256 or the next power of 2 greater than the
length of each section of x or y
fsSampling frequency1
windowWindowing function and number of samples to use to section
x and yPeriodic Hamming window with length equal to the signal
segment length that results from dividing the signal x into
eight sections and then applying the default or specified overlap.
noverlapNumber of samples by which the sections overlapValue to obtain 50% overlap
Note

You can use the empty matrix [] to specify
the default value for any input argument except x or y.
For example, Txy = tfestimate(x,y,[],[],128) uses
a Hamming window with default length, as described above, default noverlap to
obtain 50% overlap, and the specified 128 nfft.Txy = tfestimate(x,y,window) specifies
a windowing function, divides x and y into
overlapping sections of the specified window length, and windows each
section using the specified window function. If you supply a scalar
for window, then Txy uses a
Hamming window of that length.Txy = tfestimate(x,y,window,noverlap) overlaps
the sections of x by noverlap samples. noverlap must
be an integer smaller than the length of window.[Txy,W] = tfestimate(x,y,window,noverlap,nfft) uses
the specified FFT length nfft in estimating the
PSD and CPSD estimates for the transfer function. It also returns W,
which is the vector of normalized frequencies (in rad/sample) at which
the tfestimate is estimated. For real signals,
the range of W is [0, π]
when nfft is even and [0, π)
when nfft is odd. For complex signals, the range
of W is [0, 2π).[Txy,F] = tfestimate(x,y,window,noverlap,nfft,fs) returns Txy as
a function of frequency and a vector F of frequencies
at which tfestimate estimates the transfer function. fs is
the sampling frequency in Hz. F is the same size
as Txy, so plot(F,Txy) plots
the transfer function estimate versus properly scaled frequency. For
real signals, the range of F is [0, fs/2]
when nfft is even and [0, fs/2)
when nfft is odd. For complex signals, the range
of F is [0, fs).[...] = tfestimate(x,y,...,'twosided') returns
a transfer function estimate with frequencies that range over the
entire interval from 0 to the sampling frequency, [0, fs).
Specifying 'onesided' uses from 0 to the Nyquist
frequency.tfestimate(...) with no output
arguments plots the transfer function estimate in the current figure
window.```

Syntax

`Txy = tfestimate(x,y)Txy = tfestimate(x,y,window)Txy = tfestimate(x,y,window,noverlap)[Txy,W] = tfestimate(x,y,window,noverlap,nfft)[Txy,F] = tfestimate(x,y,window,noverlap,nfft,fs)[...] = tfestimate(x,y,...,'twosided')tfestimate(...)`

Example

```Transfer Function Between Two SequencesOpen This Example
Compute and plot the transfer function estimate between two sequences, x and y. x consists of white Gaussian noise. y results from filtering x with a 30-th order lowpass filter with normalized cutoff frequency
rad/sample. Use a rectangular window to design the filter. Specify a sample rate of 500 Hz and a Hamming window of length 1024 for the transfer function estimate.
h = fir1(30,0.2,rectwin(31));
x = randn(16384,1);
y = filter(h,1,x);

fs = 500;
tfestimate(x,y,1024,[],[],fs)

Use fvtool to verify that the transfer function approximates the frequency response of the filter.fvtool(h,1,'Fs',fs)

Obtain the same result by returning the transfer function estimate in a variable and plotting its absolute value in decibels.[Txy,f] = tfestimate(x,y,1024,[],[],fs);

plot(f,mag2db(abs(Txy)))```