pwelch {phonTools} | R Documentation |
Welch's Power Spectral Density Estimate
Description
Calculates a power spectral density estimate using Welch's method.
Usage
pwelch (sound, points = 0, overlap = 0, padding = 0,
window = 'hamming', show = TRUE, fs = 1, preemphasisf = 0,
zeromax = TRUE, type,...)
Arguments
sound |
A vector representing a sound wave, or a 'sound' object. |
points |
The number of points to be included in each window. If not specified, the sound is divided into 10 equally-sized windows. |
overlap |
The amount of overlap between adjacent segments, in points. |
padding |
The amount of zero padding to be applied to each window. |
window |
The window to be applied to each segment of the signal. See windowfunc() for available options. |
show |
If FALSE, no plot is created. |
fs |
The sampling frequency of the sound. If a 'sound' object is passed this does not need to be specified. |
preemphasisf |
Preemphasis of 3 dB per octave is added to frequencies above the specified frequency. |
zeromax |
If TRUE, the maximum dB is set to 0. |
type |
The line type to be used for plotting, passes its value to the 'lty' parameter. |
... |
any additional arguments will be passed to the internal calls of 'plot'. |
Details
This function divides the signal into a number of equally-sized windows, finds the power spectrum of each one, and then finds the average across all windowed sections.
Value
The following columns:
hz |
The center frequency of the analysis bins. |
dB |
The dB magnitude/power for the analysis bin. |
Author(s)
Santiago Barreda <sbarreda@ucdavis.edu>
Examples
## make a sine wave
#sinewave = sinusoid (f = 300, fs = 1000, dur = 2000, sum = FALSE)
## add noise
#sinewave = sinewave[,2] + rnorm (length (sinewave[,2]), 0, 3)
## compare the results of pwelch() and spectralslice()
#par (mfrow = c(2,1), mar = c(4,4,1,1))
#spectralslice (sinewave, fs = 1000)
#pwelch (sinewave, points = 400, fs = 1000)