问题
I have standard periodogram produced from the spectrum function call in the R "stats" package. It produces a spectral density on the Y axis. I wish to actually inspect the amplitude of the key frequency signals.
How do i convert the spectral density to an amplitude? Is there a periodgram plot/analysis in R that produces a frequency vs amplitude plot automatically? Appreciate any advice.
回答1:
Maybe you use different terminology than I do. The help page says that value returned from the spectrum function is a list whose first two elements are:
freq
vector of frequencies at which the spectral density is estimated.
(Possibly approximate Fourier frequencies.) The units are the reciprocal
of cycles per unit time (and not per observation spacing): see ‘Details’
spec
Vector (for univariate series) or matrix (for multivariate series) of
estimates of the spectral density at frequencies corresponding to freq.
So is the $spec
element what you are calling the vector of "amplitudes"? (You haven't said what the "key frequency signals" are so I just picked the fourth frequency from the example in ?spectrum
:
lh.spec <- spectrum(lh)
lh.spec$freq[4]
#1] 0.08333333
lh.spec$spec[4]
#[1] 1.167519
来源:https://stackoverflow.com/questions/18161789/how-to-convert-spectral-density-to-amplitude