Variance (FB)

FUNCTION_BLOCK Variance

This function will update the experimental variance of the mean with respect to the new input parameter \(x_{n}\), which will be added to a series of data \(x_{n-1},\dots,n_{1}\) (stemming from previous calls).
The variance \(s\) of the data \(x_{n},\dots,x_{1}\) is calculated according to: \(s = \frac{1}{n}\sum_{i=1}^{n}\left(x_{i} - \bar{x}\right)\), where \(\bar{x}\) is the arithmetic mean of the data.
InOut:

Scope

Name

Type

Comment

Input

xEnable

BOOL

Reset

lrInputValue

LREAL

New data \(x_{n}\)

Output

lrVariance

LREAL

Experimental variance of the mean of \(x_{n},\dots,x_{1}\)