TrajDAMinMax | R Documentation |
Determines the coordinates of the first local minimum/maximum of C
in
the direction autocorrelation function of a trajectory as returned by
TrajDirectionAutocorrelations
. The end point is excluded from
consideration as a minimum, similarly the start point will not be returned as
a maximum. If the trajectory does not oscillate in direction, there will not
be a local minimum/maximum, and NULL
is returned.
TrajDAFindFirstMinimum(corr, windowSize = 10)
TrajDAFindFirstMaximum(corr, windowSize = 10)
corr |
A |
windowSize |
Size of window used to define what constitutes a local mimimum/maximum. |
Numeric vector with 2 values, deltaS
and C
, or NULL if
there is no local minimum/maximum.
TrajDirectionAutocorrelations
set.seed(42)
trj <- TrajGenerate(600, angularErrorSd = 1)
smoothed <- TrajSmoothSG(trj, 3, 11)
# Resample to fixed path length
resampled <- TrajRediscretize(smoothed, 1)
# Calculate direction autocorrelation for resampled trajectory
corr <- TrajDirectionAutocorrelations(resampled, 100)
# Extract first local minimum from autocorrelation
minPt <- TrajDAFindFirstMinimum(corr, 20)
# Plot the autocorrelation function
plot(corr, type ='l')
# Plot a red dot with a black outline at the first minimum
points(minPt["deltaS"], minPt["C"], pch = 16, col = "red", lwd = 2)
points(minPt["deltaS"], minPt["C"], col = "black", lwd = 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.