Index Show pagesource Old revisions Digg this! Del.Icio.Us Google bookmark

Utilanalz::smooth Function

list smooth(list x_y, int threshold=5, int poolN=10)

Description

A simple filter filter a list consists of list(like [0, 1] for x=0, y=1), takes the noises off.

Paramters

1. x_y list of lists, x_y is a list like [[0, 0],[1, 1],]
2. threshold int, for threshold value, if the abs(value, other_value) more than threshold, the value may be a noise
3. poolN int, how long the polling poll is. For poolN=10, the function would look forward 10 items, back 10 items, than the items poll according to the parameter threshold. If the agreement more than a half, this point is not a noise.

Return

1. a list that will return a smoothed list of data.

Detail Information

```
a =
[

[6, 6],
[7, 7],
[8, 8],
[9, 9],
[10, 100],
[11, 11],
[12, 12],
[13, 13],
]

smooth(a, int threshold=5, int poolN=3)
will return
[
[6, 6],
[7, 7],
[8, 8],
[9, 9],
[11, 11],
[12, 12],
[13, 13],
]

```

Changelog

newly built, 2012-01-21