I attempted to normalize the distance between each trajectory since the spread would be larger towards the end of the trajectory.
- Calculate a mean distance from the cluster for the trajectories for each timestep along the trajectories.
do t=1,ntime
distances=0
do j=1,ncluster
do i=1,n
distances=distances+distance2(yl(t,i),xl(t,i),yclust(t,j),xclust(t,j))
end do
end do
meandistance(t) = distances/(n*ncluster)
end do
- Calculate a mean distance for the trajectories and each cluster for each timestep along the trajectories.
do t=1,ntime
do j=1,ncluster
distances=0
do i=1,n
distances=distances+distance2(yl(t,i),xl(t,i),yclust(t,j),xclust(t,j))
end do
meandistance(t,j) = distances/(n)
end do
end do
Then divide by this mean distance when before check where distance is less than mindistance
However then every trajectory get assign to one cluster.

I attempted to normalize the distance between each trajectory since the spread would be larger towards the end of the trajectory.
Then divide by this mean distance when before check where distance is less than mindistance
However then every trajectory get assign to one cluster.