0

I'm trying to apply a filter method (Butterworth) in MATLAB to remove a static acceleration (gravity).

The problem here is the sampling rate seems to be varying. As far as I know, the sampling rate is defined as the number of samples obtained in one second (samples per second), thus fs = 1/T. T is not fixed, and it was varying in my file:

The sampling times were as follows. The fraction components represent ms.

16:25:50.032

16:25:50.192

16:25:50.352

16:25:50.512

16:25:50.671

16:25:50.832

16:25:50.991

16:25:51.151

16:25:51.312

16:25:51.472

16:25:51.632

The value of T is 100ms but here we can see that T varies between 159 and 161. I am not sure how I can calculate the sampling rate in this case?

Also, if I have a varying sampling rate, can I use still Butterworth?

Community
  • 1
  • 1
user3602893
  • 35
  • 1
  • 8
  • This seems like an issue with the sampling equipment. It actually looks like your sampling time is more or less around `160 ms`. The data itself shouldn't be affected as you are simply grabbing samples at the specified point. What you can do is try different sampling intervals (159, 160, 161), filter your signal and see what results you get, then choose the best one. – rayryeng Jun 08 '14 at 17:23
  • Maybe interpolate your original to a constant rate (use `interp1` for that), and then you can apply the filter designed for the constant rate – Luis Mendo Jun 08 '14 at 23:10
  • Thanks a lot of your response.i have an excel file, the 3 end columns designs the raw data acceleration. and the 4 first columns designe a Time (H,M,S,ms). As interpolation presumes a delta-t from the beginning. i convert those to sequential times first since the seconds. s=data(:,3)+data(:,4)/1000; % convert to seconds Then compute the time difference between readings in cumulative seconds dt=diff(datenum(2013,1,1,data(:,1),data(:,2),s))*86400*1000; but when i applied a interp1 function, it gives me this error : – user3602893 Jun 09 '14 at 10:15

0 Answers0