[R] spec.pgram returns different spectra when fast=TRUE and the number of samples is odd
Jade Mosley
j@demo@|ey @end|ng |rom protonm@||@com
Mon Oct 19 19:53:21 CEST 2020
Dear all,
This is potentially a bug in spec.pgram, when the number of samples is odd,spec.pgramreturns a different result withfast = TRUE, the example below contains the two varieties with a reference spectrum calculated manually. the number of returned spectra is also larger (50 compared to 49) whenfast = TRUE
x <- rnorm(
99
)
plot(spec.pgram(x, taper =
0
, detrend =
FALSE
, plot =
FALSE
, fast =
FALSE
)$spec, ty =
'l'
)
lines(spec.pgram(x, taper =
0
, detrend =
FALSE
,plot =
FALSE
, fast =
TRUE
)$spec, col =
'red'
)
lines(((abs(fft(x))^
2
)[
2
:
50
])/
99
, col =
'blue'
, lty =
2
)
Best regards
[[alternative HTML version deleted]]
More information about the R-help
mailing list