oceConvolve | R Documentation |
Convolve two time series, using a backward-looking method.
This function provides a straightforward convolution, which may be useful to
those who prefer not to use convolve()
and filter
in the
stats
package.
oceConvolve(x, f, end = 2)
x |
a numerical vector of observations. |
f |
a numerical vector of filter coefficients. |
end |
a flag that controls how to handle the points of the |
A vector of the convolution output.
Dan Kelley
library(oce)
t <- 0:1027
n <- length(t)
signal <- ifelse(sin(t * 2 * pi / 128) > 0, 1, 0)
tau <- 10
filter <- exp(-seq(5 * tau, 0) / tau)
filter <- filter / sum(filter)
observation <- oce.convolve(signal, filter)
plot(t, signal, type = "l")
lines(t, observation, lty = "dotted")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.