| Sum := 0 |
| num := 0 |
| for i in 1 to Nsamples ; for each data of the pattern |
| if (data[i] is stable) |
| sum := sum + data[i] |
| num := num + 1 |
| weight := sum/num |
| Sum := 0 |
| num := 0 |
| for i in 1 to Nsamples ; for each data of the pattern |
| if (data[i] is stable) |
| sum := sum + data[i] |
| num := num + 1 |
| weight := sum/num |