You specify the algorithm using the **Adaptation Method** drop-down
list in the Function Block Parameters dialog box of an adaptive lookup
table block. This section discusses the details of these algorithms.

`Sample mean`

provides the average
value of *n* output data samples and is defined as:

$$\widehat{y}(n)=\frac{1}{n}{\displaystyle \sum _{i=1}^{n}y(i)}$$

where *y*(*i*)
is the *i ^{th}* measurement
collected within a particular

$$\begin{array}{l}\widehat{y}(n)=\frac{1}{n}\left[{\displaystyle \sum _{i=1}^{n-1}y(i)+y(n)}\right]=\frac{n-1}{n}\left[\frac{1}{n-1}{\displaystyle \sum _{i=1}^{n-1}y(i)}\right]+\frac{1}{n}y(n)=\frac{n-1}{n}\widehat{y}(n-1)+\frac{1}{n}y(n)\\ \end{array}$$

where *y*(*n*)
is the *n ^{th}* data sample.

Defining *a priori estimation error* as $$e(n)=y(n)-\widehat{y}(n-1)$$, the recursive relation can
be written as:

$$\widehat{y}(n)=\widehat{y}(n-1)+\frac{1}{n}e(n)$$

where $$n\ge 1$$ and the initial estimate $$\widehat{y}(0)$$ is arbitrary.

In this expression, only the number of samples, *n*,
for each cell— rather than *n* data samples—is
stored in memory.

The adaptation method Sample Mean
has an *infinite memory*. The past data samples
have the same weight as the final sample in calculating the sample
mean. `Sample mean (with forgetting)`

uses
an algorithm with a *forgetting factor * or **Adaptation
gain** that puts more weight on the more recent samples.
This algorithm provides robustness against initial response transients
of the plant and an adjustable speed of adaptation. ```
Sample
mean (with forgetting)
```

is defined as:

$$\begin{array}{c}\widehat{y}(n)=\frac{1}{{\displaystyle {\sum}_{i=1}^{n}{\lambda}^{n-i}}}{\displaystyle \sum _{i=1}^{n}{\lambda}^{n-i}}y(i)\\ =\frac{1}{{\displaystyle {\sum}_{i=1}^{n}{\lambda}^{n-i}}}\left[{\displaystyle \sum _{i=1}^{n-1}{\lambda}^{n-i}}y(i)+y(n)\right]=\frac{s(n-1)}{s(n)}\widehat{y}(n-1)+\frac{1}{s(n)}y(n)\\ \end{array}$$

where $$\lambda \in \left[0,1\right]$$ is
the **Adaptation gain** and $$s(k)={\displaystyle {\sum}_{i=1}^{k}{\lambda}^{n-i}}$$.

Defining *a priori estimation error* as $$e(n)=y(n)-\widehat{y}(n-1)$$, where $$n\ge 1$$ and the initial estimate $$\widehat{y}(0)$$ is arbitrary, the recursive
relation can be written as:

$$\widehat{y}(n)=\widehat{y}(n-1)+\frac{1}{s(n)}e(n)=\widehat{y}(n-1)+\frac{1-\lambda}{1-{\lambda}^{n}}e(n)$$

A small value of λ results in faster adaptation. A value of `0`

indicates
short memory (last data becomes the table value), and a value of `1`

indicates
long memory (average all data received in a cell).