Applying sgolay filter (derivatives) on data with variable Fs

12 views (last 30 days)
I have some x and y (pixel) coordinates recorded by an eye-tracking device that were collected using a sensor that as not a steady Fs (sample rate) and want to apply a SGOLAY filter to my signal to remove noise and compute the velocity and acceleration of the movement.
I'm following the example in the Mathworks help secction regarding Savitzky-Golay Differentiation. But they use a predetermined fixed Fs can someone help me and explain how can I apply the filter for an variable Fs (I have the time of aquisition of each coordinate in seconds).
Adding more information I'm currently reading an article that states the following:
"In principle, this filter finds the polynomial function that best describes the raw data and differentiates the polynomial analytically to avoid adding noise. It then resamples the differentiated polynomial to the original sampling fre- quency. Applying the sgolay function in MATLAB, we can f ind a set of SG differentiation f ilters, which, given the raw gaze coordinates (xi, yi), output smoothed ve- locity (xi, yi) and acceleration (xi, yi) data for the x- and y-dimensions separately. Then the total angular velocity and acceleration are calculated as the Euclidean distance of the x- and y-components:
where PHI denotes a factor for converting from pixels to visual degrees. Velocity and acceleration data were ap- propriately adjusted to compensate for the time shift in- troduced by the filters."
I'm trying to apply this, algorythm.. but I'm dueling to understand what they are actually doing.. it looks like they are passing coordinates to the sgolay and they are given an output of component velocity/acceleration.
  1 Comment
Natalie St. John
Natalie St. John on 16 Jun 2020
Hi! I unfortunately can't help you with your question regarding variable frequencies. However, I'm also using the methods in the Nystrom & Holmqvist 2010 paper to classify saccades and fixations from gaze coordinates. I have one note: in the second function you posted (for acceleration), shouldn't you multiply by the frequency squared, since it is the 2nd derivative?

Sign in to comment.

Accepted Answer

Star Strider
Star Strider on 24 May 2020
Every signal processing technique that I am aware of (except the newly-introduced nufft function) requires uniformly-sampled signals. Since you have the Signal Processing Toolbox, use the techniques described in: Interpolate/Adjust to new Sampling Rate to create a uniform sampling interval. Then proceed with sgolay as described in the documentation to get the derivatives.
I have no experience with sgolay in that respect, only sgolayfilt, so my ability to help you with it is limited to the documentation that you have already discovered. I generally calculate numeric derivatives using the gradient function on signals that have already been smoothed, since taking the derivative amplifies any noise that might be present.
.

More Answers (0)

Products


Release

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!