3.85 FAQ-323 How to perform column calculation over a sliding window, such as moving average or moving standard deviation?
Last Update: 4/26/2022
Use Built-in Moving/Rolling Functions
Origin provides several built-in functions that let you specify backward and/or forward window size:
For example, to use the Movavg function, in the Set Values dialog, do the following:
- Select the column or cells where you want to put the result.
- Select from menu Column: Set Column Value... to open the dialog (or press CTRL + Q from keyboard).
- In the opened dialog, click Function: Statistics: Movavg(vd,back,forward) to auto-fill the movavg function in the column formula text box.
- Replace vd with the range on which you want to compute a moving average.
- Replace back with the backward offset respect to current position, and forward with the forward offset respect to current position.
- Click the OK button.
Modify other functions to be Moving/Rolling Functions
You can use sub-ranges in your Set Column Value formula to specify a sliding window.
For example, to calculate the standard deviation over a window size of 11, you can specify sub-range in your formula, such as:
Use the Formula: Load Sample menu in the Set Values dialog for examples on column value calculations.
Note: To calculate moving average on a plot, you can use Analysis: Signal Processing: Smoothing tool and set Method as Adjacent-Averaging.
Keywords:Moving, Rolling, Sliding, average, mean, standard deviation, std, SMA