[CSC 335] Boxcar Filter
Andrew J. Pounds
pounds_aj at mercer.edu
Mon Oct 17 18:09:29 EDT 2011
I got some questions this past weekend on boxcar filtering -- so I
want to clarify some things.
There are TWO variables associated with the boxcar filter: size and passes.
For the purposes of this discussion lets imagine we have an array of 10
elements with a boxcar size of five doing two passes.
There are multiple ways to implement the boxcar average -- but so we
will all get the same (or similar results) lets standardize on one
method that should give reasonable results without "end tail effects".
Here is my list of elements:
1
2
3
4
5
6
7
8
9
10
273
237
302
786
1027
635
400
370
202
250
Now -- with a boxcar size of 5 I could start in element 3, average
elements 1-5, and replace element three by that value. the problem is
that if I apply such a filter several times the ends will tend to "tail
up". So, lets do the following.
The first element to be averaged will be the first element in the array,
but the boxcar will only extend to the right (boxcar size)/2 -- so out
to 3. So the first element would be replaced by the average of elements
1, 2, and 3.
After first operation the array looks like...
1
2
3
4
5
6
7
8
9
10
271
237
302
786
1027
635
400
370
202
250
In the next operation the center of the box slides one to the left so
cell 2 is replace with the average of cells 1-4.
1
2
3
4
5
6
7
8
9
10
271
399
302
786
1027
635
400
370
202
250
In the next step the full "five sized" box is being used so 3 is replace
by the average of 1-5
1
2
3
4
5
6
7
8
9
10
271
399
557
786
1027
635
400
370
202
250
The boxsize of 5 would then be used used until one got to element 8.
After that element 9 would be calculated as the average of 7-10 and
element 10 would be calculated as the average of elements 8-10.
If I did three passes then I would repeat this process three times.
Hope that helps alleviate any confusion.
--
Andrew J. Pounds, Ph.D. (pounds at theochem.mercer.edu)
Associate Professor of Chemistry and Computer Science
Mercer University, Macon, GA 31207 (478) 301-5627
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://theochem.mercer.edu/pipermail/csc335/attachments/20111017/f15065e2/attachment.html
More information about the csc335
mailing list