# Create smooth curves
t <- seq(0, 2*pi, length.out = 100)
X <- matrix(0, 10, 100)
for (i in 1:10) X[i, ] <- sin(t + i/5)
fd <- fdata(X, argvals = t)
# First derivative (should be approximately cos)
fd_deriv <- deriv(fd, nderiv = 1)
Run the code above in your browser using DataLab