On Fri, 2005-09-16 at 04:41 +0100, Lee Elliott wrote: > Hello List, > > I think there's a small bug in the moving-average filter in ... > xmlauto.cxx > else if (filterType == movingAverage) > { > output.push_front(output[0] + > (input[0] - input.back()) / > (samples - 1)); > unsigned int i; > for ( i = 0; i < output_list.size(); ++i ) { > output_list[i]->setDoubleValue( output[0] ); > } > output.resize(1); > }
I'm not trying to flame, but why would you be using a moving average filter? That's the most complicated filter I've ever seen - it calls other functions! I always liked the simplicity of a low pass filter: output += (measurement - output) * gain; Using floats, doubles, or fixed point of course. No need to call a function either, just in-line it where you need it. Want fast convergence on startup? Just sweep the gain from 1.0 down to whatever the steady state value needs to be. I bet this is nothing new - it's probably in the code under "else if (filterType == IIRfilter)" or something. So why do people use moving average filters? Why does FGFS? Thanks, Paul _______________________________________________ Flightgear-devel mailing list Flightgear-devel@flightgear.org http://mail.flightgear.org/mailman/listinfo/flightgear-devel 2f585eeea02e2c79d7b1d8c4963bae2d