DSP Blockset    
Mean

Find the mean value of an input or sequence of inputs.

Library

Statistics

Description

The Mean block computes the mean of each column in the input, or tracks the mean values in a sequence of inputs over a period of time. The Running mean parameter selects between basic operation and running operation.

Basic Operation

When the Running mean check box is not selected, the block computes the mean of each column of M-by-N input matrix u independently at each sample time.

For convenience, length-M 1-D vector inputs and sample-based length-M row vector inputs are both treated as M-by-1 column vectors.

The output at each sample time, y, is a 1-by-N vector containing the mean value for each column in u. The mean of a complex input is computed independently for the real and imaginary components, as shown below.

The frame status of the output is the same as that of the input.

Running Operation

When the Running mean check box is selected, the block tracks the mean value of each channel in a time-sequence of M-by-N inputs. For sample-based inputs, the output is a sample-based M-by-N matrix with each element yij containing the mean value of element uij over all inputs since the last reset. For frame-based inputs, the output is a frame-based M-by-N matrix with each element yij containing the mean value of the jth column over all inputs since the last reset, up to and including element uij of the current input.

As in basic operation, length-M 1-D vector inputs and sample-based length-M row vector inputs are both treated as M-by-1 column vectors.

Resetting the Running Mean.   The block resets the running mean whenever a reset event is detected at the optional Rst port. The rate of the reset signal must be a positive integer multiple of the rate of the data signal input.

When the block is reset for sample-based inputs, the running mean for each channel is initialized to the value in the corresponding channel of the current input. For frame-based inputs, the running mean for each channel is initialized to the earliest value in each channel of the current input.

The reset event is specified by the Reset port parameter, and can be one of the following:

Example

The Mean block in the model below calculates the running mean of a frame-based 3-by-2 (two-channel) matrix input, u. The running mean is reset at t=2 by an impulse to the block's Rst port.

The Mean block has the following settings:

The Signal From Workspace block has the following settings:

where

The Discrete Impulse block has the following settings:

The block's operation is shown in the figure below.

The statsdem demo illustrates the operation of several blocks from the Statistics library.

Dialog Box

Running mean
Enables running operation when selected.
Reset port
Determines the reset event that causes the block to reset the running mean. The rate of the reset signal must be a positive integer multiple of the rate of the data signal input. This parameter is enabled only when you set the Running mean parameter. For more information, see Resetting the Running Mean.

Supported Data Types

To learn how to convert to the above data types in MATLAB and Simulink, see Supported Data Types and How to Convert to Them.

See Also

Maximum
DSP Blockset
Median
DSP Blockset
Minimum
DSP Blockset
Standard Deviation
DSP Blockset
mean
MATLAB

Also see Statistics for a list of all the blocks in the Statistics library.


  Maximum Median