问题
I know that the Complementary Filter has the functions of both LPF and HPF. But I think my understanding on the principal behind it is still unclear.
I am quite new on digital signal processing, and maybe some very fundamental explanations will help a lot.
Say I have a Complementary Filter as follows:
y = a * y + (1 - a) * x
Then my parameter a
may be calculated by
a = time_constant / (time_constant + sample_period)
,
where the sample_period
is simply the reciprocal of the sampling_frequency
.
The time_constant
seems to be at my own choice.
My Questions:
- What is the theory behind this calculation?
- How do we choose the
time_constant
properly?
Note: I also posted this question on robotics, as the answers there are likely to be slightly different in emphasis.
回答1:
What is the theory behind this calculation?
For a human readable introduction I would recommend:
The Balance Filter: A Simple Solution for Integrating Accelerometer and Gyroscope Measurements for a Balancing Platform.
How do we choose the time_constant properly?
Intuitively, the time_constant
is the boundary between trusting the high-pass and the low-pass filter part. For shorter times than the time_constant
you trust the high-pass filter part more, and for longer times you trust the low-pass part more.
Usually, you have some experience with the physical process you are dealing with and you can guess at least the order of magnitude of the time_constant
. For example, if you are fusing accelerometer and gyro data (which I assume you do based on your other question), something between 0.5-1 second is a reasonable first guess. Then, you start tuning your filter by analyzing its performance on actual data and adjusting a
accordingly.
来源:https://stackoverflow.com/questions/18095785/how-to-determine-the-parameter-alpha-of-a-complementary-filter