Description Usage Arguments Value Note Examples
Generate a vector of numeric data points representing a sine wave
1 2 |
freq |
The frequency of cycles per unit time (e.g. Hz) of the sine wave |
phase |
The frequency in degrees of the sine wave |
amp |
The amplitude of the sine wave |
Nsamples |
The number of samples to generate, this defaults to the time * sample rate. |
samplerate |
The number of samples to create per unit of time |
time |
The number of units of time represented by the generated sine wave |
as.time.series |
Should the result be returned as a time series ts() |
A numeric vector or a time series representing the specified sine wave
coh is calculated as coh[, i + (j - 1) * (j - 2)/2] <- Mod(pgram[, i, j])^2/(spec[, i] * spec[, j]) Mod(pgram[, i, j])^2 #cross-amplitude values
1 2 3 4 5 6 7 8 | plot(makewave(2,0,3.889*1.6,180,60))
sp <- spectrum(ts.union(makewave(15,30,1,180,60),makewave(15.01,60,1,180,60)),span=c(3),taper=0)
with(sp,data.frame(freq=freq,sta.freq=freq/60,phase=round(phase,4),coh=round(coh,4),phase.deg=round(phase/(2*pi)*180,2)))[c(35,45,55),]
plot(sp$freq,sp$phase/(2*pi)*180,type="l")
plot(sp,plot.type="phase")
plot(sp,plot.type="coh")
plot(ts.union(makewave(15,30,1,180,60),makewave(15.01,60,1,180,60)))
Mod(mvfft(ts.union(makewave(15,30,1,180,60),makewave(15.01,60,1,180,60))))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.