# Linear interpolation
Interpol <- function(t, y) {
# y: sample
# t : warping function
m <- length(y)
# t <= m-1
# because if t > m-1, y[ti+1] will be NA when we compute g
valid <- 1 <= t & t <= m-1 # FIXME it was '<' in Bubble v2
s <- (1:m)[valid]
ti <- floor(t[s])
tr <- t[s] - ti
g <- y[ti + 1] - y[ti]
f <- y[ti] + tr * g
list(f=f, s=s, g=g)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.