powered by
Smooths a trajectory using a Savitzky-Golay smoothing filter.
TrajSmoothSG(trj, p = 3, n = p + 3 - p%%2, ...)
The trajectory to be smoothed.
polynomial order (passed to sgolayfilt).
sgolayfilt
Filter length (or window size), must be an odd number. Passed to sgolayfilt.
Additional arguments are passed to sgolayfilt.
A new trajectory which is a smoothed version of the input trajectory.
# NOT RUN { set.seed(3) trj <- TrajGenerate(500, random = TRUE, angularErrorSd = .25) smoothed <- TrajSmoothSG(trj, 3, 31) plot(trj) plot(smoothed, col = "red", add = TRUE) # }
Run the code above in your browser using DataLab