library(oce)
b <- rep(1,5)/5
a <- 1
x <- seq(1, 4, by=0.2)
y <- oce.filter(b, a, x)
plot(x, y)
points(x, x, pch="x", col="red") # note that y is offset
# remove the phase lag
y <- rev(oce.filter(b, a, rev(oce.filter(b, a, x))))
points(x, y, pch="+", col="blue")
Run the code above in your browser using DataLab