Main Content

What Are Moving Statistics?

你可以测量统计的年代treaming signals in MATLAB®and Simulink®along each independent data channel using the moving statistics System objects and blocks. Statistics such as average, RMS, standard deviation, variance, median, maximum, and minimum change as the data changes constantly with time. With every data sample that comes in, the System objects and blocks compute the statistics over the current sample and a specific window of past samples. This window "moves" as new data comes in.

MATLAB System object™ Simulink Block Statistic Computed
dsp.MedianFilter Median Filter Moving median
dsp.MovingAverage Moving Average Moving average
dsp.MovingMaximum Moving Maximum Moving maximum
dsp.MovingMinimum Moving Minimum Moving minimum
dsp.MovingRMS Moving RMS Moving RMS
dsp.MovingStandardDeviation Moving Standard Deviation Moving standard deviation
dsp.MovingVariance Moving Variance Moving variance

These System objects and blocks compute the moving statistic using one or both of the sliding window method and exponential weighting method. For more details on these methods, see滑动窗口法和指数加权我thod.

Consider an example of computing the moving average of a streaming input data using the sliding window method. The algorithm uses a window length of 4. At the first time step, the algorithm fills the window with three zeros to represent the first three samples. In the subsequent time steps, to fill the window, the algorithm uses samples from the previous data frame. The moving statistic algorithms have a state and remember the previous data.

If the data is stationary, use the stationary statistics blocks to compute the statistics over the entire data in Simulink. Stationary blocks includeAutocorrelation,Correlation,Maximum,Mean,Median,Minimum,RMS,Sort,Standard Deviation, andVariance.

These blocks do not maintain a state. When a new data sample comes in, the algorithm computes the statistic over the entire data and has no influence from the previous state of the block.

Consider an example of computing the stationary average of streaming input data using theMeanblock in Simulink. TheMeanblock is configured to find the mean value over each column.

At each time step, the algorithm computes the average over the entire data that is available in the current time step and does not use data from the previous time step. The stationary statistics blocks are more suitable for data that is already available rather than for streaming data.

Related Topics