Tuesday, 28 April 2015

digital filters - Exponential weighted moving average time constant


I think it is an easy question but I am stuck.


I want to derive that α=eTτ.


Can someone provide me with an answer?


[EDIT] Sorry guys, this was really a senseless question. Here are some more informations. The differential equation of the EWMA: y(n)=αx(n)+(1α)y(n1)

and the corresponding frequency magnitude response: HE(z)=α1(1α)z1
and in the frequency domain for ωs=1T=1 : HE(ω)=α12(1α)cos(ω)+(1α)2
τ=12πω3dB


Hence HE(ω3dB)=α12(1α)cos(ω3dB)+(1α)2!=12.


I'm looking for α, given an ω3dB.



Answer



If I understood you correctly, you want to compute the value of α that results in a specified 3dB cut-off frequency for an exponentially weighted moving average filter. If you square your last equation, you get


α212(1α)cos(ωc)+(1α)2=12



which can be rearranged into the following quadratic equation:


α2+2α(1cos(ωc))2(1cos(ωc))=0


with the positive solution


α=cos(ωc)1+cos2(ωc)4cos(ωc)+3


So, e.g., for a desired cut-off frequency ωc=0.2π, you obtain from (3) a value of α=0.455886780102867. The figure below shows the magnitude of the frequency response of the resulting exponentially weighted moving average filter, from which you can see that the desired cut-off frequency is achieved.


enter image description here


EDIT: The formula for α in your question should actually be


α=1eT/τ,τ=1/Ωc


Note that unlike ωc in Eq. (3), Ωc in Eq. (4) is not normalized by the sampling frequency. So we have T/τ=ΩcT=ωc.


Eq. (4) is an approximation, and it comes from applying the impulse invariant transformation to the continuous-time transfer function



H(s)=11+sτ


which has a 3dB cut-off frequency ωc=1/τ. Applying the impulse invariant transformation to (5) gives


H(z)=Tτ11eT/τz1


Comparing the denominator of (6) with the denominator of the discrete-time transfer function of an EWMA filter


H(z)=α1(1α)z1


results in the given formula. Note, however, that this is only an approximation. Especially for cut-off frequencies close to Nyquist, the error of formula (4) becomes relatively large.


No comments:

Post a Comment

readings - Appending 内 to a company name is read ない or うち?

For example, if I say マイクロソフト内のパートナーシップは強いです, is the 内 here read as うち or ない? Answer 「内」 in the form: 「Proper Noun + 内」 is always read 「ない...