stft | R Documentation |
Compute the short-term Fourier transform of a vector or matrix.
stft(
x,
window = nextpow2(sqrt(NROW(x))),
overlap = 0.75,
nfft = ifelse(isScalar(window), window, length(window)),
fs = 1
)
x |
input data, specified as a numeric or complex 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.75. |
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. |
A list containing the following elements:
f
vector of frequencies at which the STFT is 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.
t
vector of time points at which the STFT is estimated.
s
Short-time Fourier transform, returned as a matrix or
a 3-D array. Time increases across the columns of s
and frequency
increases down the rows. The third dimension, if present, corresponds to
the input channels.
Andreas Weingessel, Andreas.Weingessel@ci.tuwien.ac.at.
Conversion to R by Geert van Boxtel, G.J.M.vanBoxtel@gmail.com.
fs <- 8000
y <- chirp(seq(0, 5 - 1/fs, by = 1/fs), 200, 2, 500, "logarithmic")
ft <- stft (y, fs = fs)
filled.contour(ft$t, ft$f, t(ft$s), xlab = "Time (s)",
ylab = "Frequency (Hz)")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.