pwelch | R Documentation |
Estimates the power spectral density (PSD) of an input signal using Welch's method. This should function similarly to the Matlab function pwelch, but results may not be identical. Breaks the input signal into (usually) overlapping frames and averages the resulting PSD estimates
pwelch(
x,
nfft,
noverlap = 0,
sr = NULL,
window = NULL,
demean = c("long", "short", "none"),
channel = 1
)
x |
input signal, either a numeric vector, Wave,
WaveMC, or |
nfft |
length of FFT window to use for individual frames |
noverlap |
number of samples each frame should overlap |
sr |
sample rate of data, only necessary if |
window |
window to apply, must be a vector of length |
demean |
method of demeaning the signal, one of |
channel |
channel number to analyse, ignored if |
returns a list with items spec
, the PSD estimate of the
input signal, and freq
, the frequency values (Hz) at
each value of spec
Taiki Sakai taiki.sakai@noaa.gov
# wav example is synthetic echolocation clicks at 4kHz
wavFile <- system.file('extdata/testWav.wav', package='PAMmisc')
psd <- pwelch(wavFile, nfft=1e3, noverlap=500, demean='long')
plot(x=psd$freq, y=10*log10(psd$spec), type='l')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.