At 01:25 PM 5/13/00 +0200, Tony wrote: >Anyway my initial findings indicate that these filters are >, as stated by others, not equal. They have different freq. >responce and calculation properties. True. You adjust those parameters to suit requirements. >The FIR I implemented is, albeit memory hungry, very fast >to calculate and have a linear step-responce. The IIR EWMA formula I gave [ Y(n+1)=Y(n) + alpha*(X(n+1)-Y(n)) ] is about as simple as it gets. The formula is linear, so the filter is linear. I don't see the advantage of a 'linear step-response'. > >2. If you are concerned about the increased error in the first few >samples, > >you can generate a slightly more complicated optimum (Kalman) filter. >(This > >involves a changing weighting factor). > >Do you mean that the weighing should leans towards the new sample >more at the start ? In that case that was my idea, I would also >use this in the 'running' filter to increase the step-repsonse. >( would have a similar effect as the variable window in the FIR ) The Kalman filter is (without an error term) the exact average of all the data so far experience, with a formula in recursive form. The presence of a stochastic term de-tunes those exact formula to not feedback all the information in the next same to the next filtered value. The asymptotic form of the Kalman filter (after 100 samples or so for transients to die out) is the EWMA form I gave above. The size of 'alpha' is dictated by the relative size of the stochastic term. As I mentioned before, the simplest interpretation is 1/alpha ~ window length of a moving average. In actuality, the weighting coefficients are alpha, alpha^2, ..., a exponentially declining (geometric) series. > >3. The optimum value for alpha is about equal in magnitude to the >1-order > >autocorrelation of the data. > >Sorry, dont know if it's my english, but I dont really understand what >You mean here. This is true only for small autocorrelation, in any event. An 'exact' formula is: autocovariance: C(k) = sum(k+1,n) {[ X(i)-Xave]*[X(i-k)-Xave]} /n autocorrelation: r(k) = C(k)/C(0) alpha = [1-sqrt( 1 - 4 r(1)*r(1) )]/(2*r(1)) This is 'invertible' (i.e., stable) for abs(r(1))<1/2. ================================================================ Robert A. LaBudde, PhD, PAS, Dpl. ACAFS e-mail: ral@lcfltd.com Least Cost Formulations, Ltd. URL: http://lcfltd.com/ 824 Timberlake Drive Tel: 757-467-0954 Virginia Beach, VA 23464-3239 Fax: 757-467-2947 "Vere scire est per causas scire" ================================================================