# LGF_AverageAndDeviation (FC / V3.0.1)

Author: Siemens Digital Industry

## Short description

This function calculates the arithmetic mean and the standard deviation from a series of numbers.

### Block Interface

| LGF_AverageAndDeviation (FC) |
--- | --- | ---
Array[*] of LReal |  |  | variableArray |  | Ret_Val |  |  | Void
|  |  |  |  | arithmeticAverage |  |  | LReal
|  |  |  |  | standardDeviation |  |  | LReal

### Input parameter

Identifier | Data type | Description
--- | --- | ---
variableArray | Array[*] of LReal | Sequence of numbers to calculate with

### Output parameter

Identifier | Data type | Description
--- | --- | ---
Ret_Val | Void | Void - Function has no return value
arithmeticAverage | LReal | Calculated arithmetic average value
standardDeviation | LReal | Calculated standard deviation

## Functional description

An array of any size is connected via the `variableArray` input. After reading-out the array boundaries, the arithmetic mean value and the standard deviation will be calculated from the values and both will be output.

Note
  An array with too many elements can cause the cycle monitoring time to be exceeded.

## Change log

Version & Date | Change description
--- | ---
| 01.00.00 | Siemens Industry Online Support
| 19.08.2015 | First released version
| 01.00.01 | Siemens Industry Online Support
| 16.11.2015 | Bug fix at WRONG_TYPE: #error := true
| 01.00.02 | Siemens Industry Online Support
| 02.01.2017 | Upgrade: TIA Portal V14 Update 1
| 01.00.03 | Siemens Industry Online Support
| 17.08.2018 | Upgrade: TIA V15 Update 2
| 01.00.04 | Siemens Industry Online Support
| 23.11.2018 | Upgrade: TIA V15.1
| 02.00.00 | Simatic Systems Support
| 25.01.2019 | Data type changed from Variant to Array[*] of LReal
| 02.00.01 | Simatic Systems Support
| 31.10.2019 | Regions, comments and constants are added
| 03.00.00 | Simatic Systems Support
| 23.04.2020 | Set version to V3.0.0, harmonize the version of the whole library
| 03.00.01 | Simatic Systems Support
| 06.04.2021 | Insert documentation