The Statistics library provides fundamental statistical operations such as minimum, maximum, mean, variance, and standard deviation. Most blocks in the Statistics library support two types of operations; basic and running.
The blocks listed below toggle between basic and running modes using the Running check box in the parameter dialog box:
An unselected Running check box means that the block is operating in basic mode, while a selected Running box means that the block is operating in running mode.
The Maximum and Minimum blocks are slightly different from the
blocks above, and provide a Mode parameter in
the block dialog box to select the type of operation. The
in the Mode menu all specify basic operation,
in each case enabling a different set of output ports on the block.
Running option in the Mode menu
selects running operation.
A basic operation is one that processes
each input independently of previous and subsequent inputs. For example,
in basic mode (with
Value and Index selected,
for example) the Maximum block finds the maximum value in each column
of the current input, and returns this result at the top output (
Val output therefore has the same
number of columns as the input, but only one row. Furthermore, the
values in a given output only depend on the values in the corresponding
input. The block repeats this operation for each successive input.
This type of operation is exactly equivalent to the MATLAB® command
val = max(u) % Equivalent MATLAB code
which computes the maximum of each column in input
The next section is an example of a basic statistical operation.
You can use the basic statistics operations in conjunction with the Buffer block to implement basic sliding window statistics operations. A sliding window is like a stencil that you move along a data stream, exposing only a set number of data points at one time.
For example, you may want to process data in 128-sample frames, moving the window along by one sample point for each operation. One way to implement such a sliding window is shown in the following ex_mean_tut model.
The Buffer block's Buffer size (Mo) parameter determines the size of the window. The Buffer overlap (L) parameter defines the "slide factor" for the window. At each sample instant, the window slides by Mo-L points. The Buffer overlap is often Mo-1, so that a new statistic is computed for every new signal sample.
A running operation is one that processes successive inputs, and computes a result that reflects both current and past inputs. In this mode, you must use the Input processing parameter to specify whether the block performs sample- or frame-based processing on the inputs. A reset port enables you to restart this tracking at any time. The running statistic is computed for each input channel independently, so the block's output is the same size as the input.
For example, in running mode (
from the Mode parameter) the Maximum block outputs
a record of the input's maximum value over time.
The following figure illustrates how a Maximum block in running
mode operates on a 3-by-2 matrix input,
when the Input processing parameter is set to
as channels (frame based). The running maximum is reset
at t=2 by an impulse to the block's optional