# Create curves with phase shifts
t <- seq(0, 2*pi, length.out = 100)
X <- matrix(0, 10, 100)
for (i in 1:10) X[i, ] <- sin(t + i*0.2) + rnorm(100, sd = 0.1)
fd <- fdata(X, argvals = t)
# Compute distance accounting for phase shifts
D <- semimetric.hshift(fd, max_shift = 10)
Run the code above in your browser using DataLab