# Example trajectories with 3 variables
traj1 <- data.frame(
Time = 1:4,
Variable1 = c(1.2, 1.4, 1.6, 1.8),
Variable2 = c(2.3, 2.1, 2.0, 1.9),
Variable3 = c(3.1, 3.3, 3.5, 3.7)
)
traj2 <- data.frame(
Time = 1:3,
Variable1 = c(2.0, 2.2, 2.4),
Variable2 = c(3.0, 2.9, 2.8),
Variable3 = c(1.0, 1.1, 1.2)
)
# Compute Fréchet distance (scalar output)
fredist(traj1, traj2, form = "scalar")
# Compute Fréchet distance matrix
fredist(traj1, traj2, form = "matrix")
Run the code above in your browser using DataLab