I have read other posts here on using the Butterworth filter in Mathematica, however, I am having a hard time understanding the chain of functions and their parameters as applied to my case, and I am not confident with what I am seeing.

I sampled the 3 axes of my accelerometer at 128 Hz in the field, and can successfully import, view and plot the CSV file in Mathematica.

I select only the column of data I am interested in, the 5th column, the Z-axis (colinear with gravity), and plot it. So far so good.

    data2 = Query[All, {5}] @data

However, when I go to chain the two functions, RecurrenceFilter and ToDiscreteTimeModel, with the ButterworthFilterModel (assigned to LPF) as an argument to ToDiscreteTimeModel like so:

    LPF = ButterworthFilterModel [{"Lowpass", 1, 5}]

    filtered = RecurrenceFilter[ToDiscreteTimeModel [LPF, 1], data2]

I can see the adjusted outputted list, which appears in the same form as the input list with the newly calculated values, however, the plot doesn't seem right:

[![Final plot of filtered Z-axis data][1]][1]

I am not sure of the syntax of the chained functions, nor the choice of 1 as the period argument given to the function ToDiscreteTimeModel, since I think that should be 0.0078125 (1/128), but neither seem to plot the way I would expect with either 1 or 0.0078125 (1/128) in there.

I would have expected a smoothed curve of the raw data before applying the filter as shown here (column 2 is just the integer index of the sample. I used just column 5 when doing the last step):

[![Plot of raw data - column 2 and column 5][2]][2]

Any feedback on whether this is simply a plotting, syntax, or function use issue would be much appreciated. Thank you.

  [1]: https://i.stack.imgur.com/CgIxz.jpg
  [2]: https://i.stack.imgur.com/VFQlS.jpg