The moving_average command applies a moving average to a sample.
| B[i]= |
|
| A[i+j] |
Moving average filters are fast and useful for smoothing time-encoded signals.
Examples.
| snd:=soundsec(2): |
| noise:=randvector(length(snd),normald,0,0.05):; |
| data:=0.5*threshold(3*sin(2*pi*220*snd),[-1.0,1.0])+noise:; |
| plotwav(createwav(data),range=[1000,1500]) |
| fdata:=moving_average(data,25):; |
| plotwav(createwav(fdata),range=[1000,1500]) |