tfestimate | R Documentation |
Finds a transfer function estimate for signals.
tfestimate(
x,
window = nextpow2(sqrt(NROW(x))),
overlap = 0.5,
nfft = ifelse(isScalar(window), window, length(window)),
fs = 1,
detrend = c("long-mean", "short-mean", "long-linear", "short-linear", "none")
)
tfe(
x,
window = nextpow2(sqrt(NROW(x))),
overlap = 0.5,
nfft = ifelse(isScalar(window), window, length(window)),
fs = 1,
detrend = c("long-mean", "short-mean", "long-linear", "short-linear", "none")
)
x |
input data, specified as a numeric vector or matrix. In case of a vector it represents a single signal; in case of a matrix each column is a signal. |
window |
If |
overlap |
segment overlap, specified as a numeric value expressed as a multiple of window or segment length. 0 <= overlap < 1. Default: 0.5. |
nfft |
Length of FFT, specified as an integer scalar. The default is the
length of the |
fs |
sampling frequency (Hertz), specified as a positive scalar. Default: 1. |
detrend |
character string specifying detrending option; one of:
|
tfestimate
uses Welch's averaged periodogram method.
A list containing the following elements:
freq
vector of frequencies at which the spectral variables
are estimated. If x
is numeric, power from negative frequencies is
added to the positive side of the spectrum, but not at zero or Nyquist
(fs/2) frequencies. This keeps power equal in time and spectral domains.
If x
is complex, then the whole frequency range is returned.
trans
NULL for univariate series. For multivariate series,
a matrix containing the transfer function estimates between different
series. Column i + (j - 1) * (j - 2)/2
of coh
contains the
cross-spectral estimates between columns i
and j
of x
,
where i < j
.
The function tfestimate
(and its deprecated alias tfe
)
is a wrapper for the function pwelch
, which is more complete and
more flexible.
Peter V. Lanspeary, pvl@mecheng.adelaide.edu.au.
Conversion to R by Geert van Boxtel, G.J.M.vanBoxtel@gmail.com.
pwelch
fs <- 1000
f <- 250
t <- seq(0, 1 - 1/fs, 1/fs)
s1 <- sin(2 * pi * f * t) + runif(length(t))
s2 <- sin(2 * pi * f * t - pi / 3) + runif(length(t))
rv <- tfestimate(cbind(s1, s2), fs = fs)
plot(rv$freq, 10*log10(abs(rv$trans)), type="l", xlab = "Frequency",
ylab = "Tranfer Function Estimate (dB)", main = colnames((rv$trans)))
h <- fir1(30, 0.2, window = rectwin(31))
x <- rnorm(16384)
y <- filter(h, x)
tfe <- tfestimate(cbind(x, y), 1024, fs = 500)
plot(tfe$freq, 10*log10(abs(tfe$trans)), type="l", xlab = "Frequency",
ylab = "Tranfer Function Estimate (dB)", main = colnames((tfe$trans)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.