How to determine the parameter of a Complementary Filter? 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\times y+(1-a)\times x$$

Then my parameter $a$ may be calculated by $$a=\frac{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?
This is the difference equation for a low pass filter.  Five time constants (5 * 1 time constant) is the time it will take to for the output, to reach 99.33% of the value of the input, from when the input changes from 0 to its final value, and stays there (a step response).  This comes from 1-e^(-5).  As you are specifying time constants, it implies you want a time domain definition for use as a moving average filter, so specify the period of averaging you would like, assume that as 5 time constants and divide by 5 five to get one time constant for use in the equation you have quoted above.