demod(x, centerfreq, passfreq, stopfreq, wrapphase=F)
passfreq
must be less than
stopfreq
.
TRUE
, then
phase
is wrapped into the interval [- pi, pi].
When
FALSE
,
phase
is made continuous by not allowing jumps
greater than
2
times pi.
x
containing the amplitude at frequency
centerfreq
.
x
containing the phase in radians
at frequency
centerfreq
.
centerfreq
.
stopfreq
.
passfreq
.
Missing values at the ends of the series are excluded from the computations.
The phase and amplitude of the demodulation are smoothed with a least
squares approximation to a lowpass filter.
The cutoff of the filter is half-way between
passfreq
and
stopfreq
.
The number of terms in the filter is
floor(2*max(2,d)+1)
, where
d=frequency(x)/(stopfreq-passfreq)
.
Complex demodulation is a technique for analyzing nonstationary time series by estimating the instantaneous amplitude and phase of a given harmonic component. See Bloomfield (1976) for an account of the method. To better understand the results of complex demodulation several lowpass filters should be tried: the smaller the pass band, the less instantaneous in time but more specific in frequency is the result.
Bloomfield, P. (1976).
Fourier Analysis of Time Series: An Introduction.
Wiley, New York.
The chapter "Analyzing Time Series" of the S-PLUS Guide to Statistical and Mathematical Analysis.
p <- spectrum(sunspots, span=c(7,5), plot=F) fpeak <- p$freq[p$spec==max(p$spec)] # the frequency of the spectral peak d <- demod(sunspots, fpeak, .02, .04) par(mar=c(5,4,4,4)+.1) tsplot(d$amp, lty=1, ylab="amplitude") legend(1750, 40, c("amplitude", "phase"), lty=1:2) par(new=T) tsplot(d$phase, lty=2, main="Sunspot Demodulation", axes=F) axis (4) mtext(side=4, line=3, "phase") # a sloped phase plot indicates that the frequency used # is slightly off the mark