# dsp.AffineProjectionFilter

Compute output, error and coefficients using affine projection (AP) Algorithm

## Description

The `dsp.AffineProjectionFilter`

System object™ filters each channel of the input using AP filter implementations.

To filter each channel of the input:

Create the

`dsp.AffineProjectionFilter`

object and set its properties.Call the object with arguments, as if it were a function.

To learn more about how System objects work, see What Are System Objects?

## Creation

### Syntax

### Description

returns an
adaptive FIR filter System object, `apf`

= dsp.AffineProjectionFilter`apf`

. This System object computes the filtered output and the filter error for a given input and
desired signal using the affine projection (AP) algorithm.

returns an affine projection filter object with the `apf`

= dsp.AffineProjectionFilter(`len`

)`Length`

property
set to `len`

.

returns an affine projection filter object with each specified property set to the
specified value. Enclose each property name in single quotes. Unspecified properties have
default values.`apf`

= dsp.AffineProjectionFilter(`Name,Value`

)

## Properties

## Usage

### Syntax

### Description

`[`

filters the input `y`

,`err`

] = apf(`x`

,`d`

)`x`

, using `d`

as the desired
signal, and returns the filtered output in `y`

and the filter error in
`err`

. The System object estimates the filter weights needed to
minimize the error between the output signal and the desired signal. You can access these
coefficients by accessing the `Coefficients`

property of the object.
This can be done only after calling the object. For example, to access the optimized
coefficients of the `apf`

filter, call
`apf.Coefficients`

after you pass the input and desired signal to the
object.

### Input Arguments

### Output Arguments

## Object Functions

To use an object function, specify the
System object as the first input argument. For
example, to release system resources of a System object named `obj`

, use
this syntax:

release(obj)

## Examples

## Algorithms

The affine projection algorithm (APA) is an adaptive scheme that estimates an unknown system based on multiple input vectors [1]. It is designed to improve the performance of other adaptive algorithms, mainly those that are LMS based. The affine projection algorithm reuses old data resulting in fast convergence when the input signal is highly correlated, leading to a family of algorithms that can make trade-offs between computation complexity with convergence speed [2].

The following equations describe the conceptual algorithm used in designing AP filters:

$$\begin{array}{l}Uap(n)=\left(\begin{array}{ccc}u{(n)}_{}& \dots & u(n-L)\\ \vdots & \ddots & \vdots \\ u{(n-N)}_{}& \cdots & u(n-L-N)\end{array}\right)=\left(\begin{array}{ccc}u(n)& u(n-1)& \cdots \begin{array}{cc}& u(n-L)\end{array}\end{array}\right)\\ yap(n)={U}^{T}ap(n)w(n)=\left(\begin{array}{c}y(n)\\ \xb7\\ \xb7\\ \xb7\\ y(n-L)\end{array}\right)\\ dap(n)=\left(\begin{array}{c}d(n)\\ \xb7\\ \xb7\\ \xb7\\ d(n-L)\end{array}\right)\\ eap(n)=dap(n)-yap(n)=\left(\begin{array}{c}e(n)\\ \xb7\\ \xb7\\ \xb7\\ e(n-L)\end{array}\right)\\ w(n)=w(n-1)+\mu Uap(n){(}^{U}eap\end{array}$$

where **C** is either ε**I** if
the initial offset covariance is a scalar ε, or **R** if
the initial offset covariance is a matrix **R**.
The variables are as follows:

Variable | Description |
---|---|

n | The current time index |

u(n) | The input sample at step n |

U_{ap}(n) | The matrix of the last L+1 input signal vectors |

w(n) | The adaptive filter coefficients vector |

y(n) | The adaptive filter output |

d(n) | The desired signal |

e(n) | The error at step n |

L | The projection order |

N | The filter order (i.e., filter length = N+1) |

μ | The step size |

## References

[1] K. Ozeki, T. Umeda, “An adaptive Filtering Algorithm Using an
Orthogonal Projection to an Affine Subspace and its Properties”, *Electron.
Commun. Jpn.* 67-A(5), May 1984, pp. 19–27.

[2] Paulo S. R. Diniz, *Adaptive Filtering: Algorithms and
Practical Implementation,* Second Edition. Boston: Kluwer Academic Publishers,
2002.

## Extended Capabilities

## Version History

**Introduced in R2013a**