Heard that this is a common technique. Mean of N samples is (1/N) sum(Xi) where Xi is one of the samples X0, X1, ... XN-1 Now if you are doing a total mean rather than a windowed mean (most recent N samples), then the new mean value is Mean = (N*MeanPrevious + Xnew)/(N+1) Not sure that there is a way to do this for standard deviation because if the mean changes, then all the difference values change. That is the hard part. Jim Wagner Oregon Research Electronics > I'm playing with an idea to make sense of analog sensors. > This is borrowed from a technique for background supression in video > cameras. > Having trouble figuring an economical way to do the means and standard > deviations. > > Take a single analog input, sampled at some appropriate rate. > > Allocate N (call it five for now..) slots for mean and standard > deviation, and "strength". > > When a new sample arrives, for each of five means, test wether the > sample falls within two standard deviations of a mean. > If so, then "strengthen" that mean, and recalculate it's standard > deviation. > If not, then kill the "weakest" mean, and start a new one with this > samples value as the mean, and some appropriate guess at standard > deviation. > > I've got code that buffers 50 samples on two inputs, and calculates > mean and standard deviation, and "alarms" when either of the input > falls outside 2sd, but the thing is computationally intensive, and I'm > told that the video guys do NOT keep N frames of data (which makes > sense, as it would get enormous FAST). Rather they have some method of > figuring a mean and standard deviation without history data... > > Does that make any sense? > How could I implement a function like that? > > > -- > > "The very powerful and the very stupid have one thing in common. Instead > of > altering their views to fit the facts, they alter the facts to fit their > views... which can be very uncomfortable if you happen to be one of the > facts that needs altering." Doctor Who, Face of Evil >
Message
Re: [AVR-Chat] GMM
2009-01-15 by wagnerj@proaxis.com
Attachments
- No local attachments were found for this message.