# LGF_AverageAndDeviation (FC / 3.0.1)

Overview

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
--- | ---
| 1.0.0 | Siemens Industry Online Support
| 19.08.2015 | First released version
| 1.0.1 | Siemens Industry Online Support
| 16.11.2015 | Bug fix at WRONG_TYPE: #error := true
| 1.0.2 | Siemens Industry Online Support
| 02.01.2017 | Upgrade: TIA Portal V14 Update 1
| 1.0.3 | Siemens Industry Online Support
| 17.08.2018 | Upgrade: TIA V15 Update 2
| 1.0.4 | Siemens Industry Online Support
| 23.11.2018 | Upgrade: TIA V15.1
| 2.0.0 | Simatic Systems Support
| 25.01.2019 | Data type changed from Variant to Array[*] of LReal
| 2.0.1 | Simatic Systems Support
| 31.10.2019 | Regions, comments and constants are added
| 3.0.0 | Simatic Systems Support
| 23.04.2020 | Set version to V3.0.0, harmonize the version of the whole library
| 3.0.1 | Simatic Systems Support
| 06.04.2021 | Insert documentation