I have a system sampling an analog input and I want to filter that value using a simple, first order filter. EG something of the form:
Yn = A*Xn + B*Yn-1
However I have no control over the underlying process and the sampling period is non-uniform, and varies (randomlyish) somewhere between 25ms and 29ms. In addition I want to use a 30 minute time constant, and can't keep a running buffer of 72,000 sample values.
Given that a typical filter implementation requires a uniform sampling period, is there any simple algorithm that takes into account the time difference between Yn-1 and Xn? (which I guess really means a time varying version of my "constants" A and B)
Note that I'm inclined to simply take the average sample time over an extended period and using that to calculate my constants, however there is also the possibility of the final system not running at the same average rate as my test system, so I want to come up with a solution that is somewhat adaptable.
answering questions
- The filtered signal is being used as a part of a vibration monitoring system in some industrial equipment. It will be used for more of as a qualitative than quantitative purpose.
- The customer requirements are 30 minute rolling average for the data.
- I have zero control over the sample rate.
- And the sample rate varies every second
- And the sample rate defines the speed at which my code runs
- The final system should run at about the same speed as my test system, however it could be somewhat slower, maybe down to a 35ms rate
Ts
, keepingTs
as a variable and not a number.A
andB
will then be a function ofTs
. RecalculateA
andB
for each sample if you know theTs
for that sample. \$\endgroup\$