In the sliding window method, the power measurement is computed over a finite duration of the signal. The window length defines the length of the data over which the algorithm computes the power value. The window moves as the new data comes in. The output for each input sample is the measurement done over the current sample and the *Len* – 1 previous samples. *Len* is the length of the sliding window in samples. To compute the first *Len* – 1 outputs, when the window does not have enough data yet, the algorithm fills the window with zeros. As an example, to compute the average power when the second input sample comes in, the algorithm fills the window with *Len* – 2 zeros. The input signal `x`

is then the two data samples followed by *Len* – 2 zeros.

For a more detailed example, see Sliding Window Method.

If the window is large, the power computed is closer to the stationary power of the data. For data that does not change rapidly, use a long window to get a smoother measurement. For data that changes fast, use a smaller window.