# Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English verison of the page.

# dsp.AffineProjectionFilter System object

Package: dsp

Compute output, error and coefficients using Affine Projection (AP) Algorithm

## Description

The `AffineProjectionFilter` object filters each channel of the input using AP filter implementations.

To filter each channel of the input:

1. Define and set up your AP filter. See Construction.

2. Call `step` to filter each channel of the input according to the properties of `dsp.AffineProjectionFilter`. The behavior of `step` is specific to each object in the toolbox.

 Note:   Starting in R2016b, instead of using the `step` method to perform the operation defined by the System object™, you can call the object with arguments, as if it were a function. For example, ```y = step(obj,x)``` and `y = obj(x)` perform equivalent operations.

## Construction

`H = dsp.AffineProjectionFilter` returns an adaptive FIR filter System object, `H`. This System object computes the filtered output and the filter error for a given input and desired signal using the Affine Projection (AP) algorithm.

```H = dsp.AffineProjectionFilter('PropertyName',PropertyValue, ...)``` returns an AP filter System object, `H`, with each specified property set to the specified value.

```H = dsp.AffineProjectionFilter(LEN, 'PropertyName', PropertyValue, ...)``` returns an AP filter System object, `H`. This System object has the Length property set to `LEN`, and other specified properties set to the specified values.

## Properties

 `Method` Method to calculate the filter coefficients Specify the method used to calculate filter coefficients as one of | `Direct Matrix Inversion` | ```Recursive Matrix Update``` | `Block Direct Matrix Inversion`. The default value is `Direct Matrix Inversion`. This property is nontunable. `Length` Length of filter coefficients vector Specify the length of the FIR filter coefficients vector as a scalar positive integer value. The default value is `32`. This property is nontunable. `ProjectionOrder` Projection order of the affine projection algorithm Specify the projection order of the affine projection algorithm as a scalar positive integer value greater than or equal to 2. This property defines the size of the input signal covariance matrix. The default value is `2`. This property is nontunable. `StepSize` Affine projection step size Specify the affine projection step size factor as a scalar non-negative numeric value between 0 and 1, both inclusive. Setting step equal to one provides the fastest convergence during adaptation. The default value is `1`. This property is tunable. `InitialCoefficients` Initial coefficients of the filter Specify the initial values of the FIR adaptive filter coefficients as a scalar or a vector of length equal to the `Length` property value. The default value is `0`. This property is tunable. `InitialOffsetCovariance` Initial values of the offset input covariance matrix Specify the initial values for the offset input covariance matrix. This property must be either a scalar positive numeric value or a positive-definite square matrix with each dimension equal to the `ProjectionOrder` property value. If it is a scalar value, the `OffsetCovariance` property is initialized to a diagonal matrix with the diagonal elements equal to that scalar value. If it is a square matrix, the` OffsetCovariance` property is initialized to the value of that square matrix. This property is applicable only if the Method property is set to ```Direct Matrix Inversion``` or `Block Direct Matrix Inversion`. The default value is `1`. This property is tunable. `InitialInverseOffsetCovariance` Initial values of the offset input covariance matrix inverse Specify the initial values for the offset input covariance matrix inverse. This property must be either a scalar positive numeric value or a positive-definite square matrix with each dimension equal to the `ProjectionOrder` property value. If it is a scalar value, the `InverseOffsetCovariance` property is initialized to a diagonal matrix with each diagonal element equal to that scalar value. If it is a square matrix, the `InverseOffsetCovariance` property is initialized to the values of that square matrix. This property is applicable only if the `Method` property is set to `Recursive Matrix Update`. The default value is `20`. This property is tunable. `InitialCorrelationCoefficients` Initial correlation coefficients Specify the initial values of the correlation coefficients of the FIR filter as a scalar or a vector of length equal to `ProjectionOrder` –`1`. This property is applicable only if the `Method` property is set to `Recursive Matrix Update`. The default value is `0`. This property is tunable. `LockCoefficients` Lock coefficient updates Specify whether the filter coefficient values should be locked. When you set this property to `true`, the filter coefficients are not updated and their values remain the same. The default value is `false` (filter coefficients are continuously updated). This property is tunable.

## Methods

 clone Create System object with same property values isLocked Locked status for input attributes and nontunable properties msesim Mean-square error for Affine Projection filter release Allow property value and input characteristics changes reset Reset the internal states of a System object step Process inputs using the affine projection filter algorithm

## Examples

expand all

Note: This example runs only in R2016b or later. If you are using an earlier release, replace each call to the function with the equivalent `step` syntax. For example, myObject(x) becomes step(myObject,x).

QPSK Adaptive Equalization Using a 32-Coefficient FIR Filter (1000 Iterations)

```D = 16; % Number of samples of delay b = exp(1i*pi/4)*[-0.7 1]; % Numerator coefficients of channel a = [1 -0.7]; % Denominator coefficients of channel ntr = 1000; % Number of iterations s = sign(randn(1,ntr+D)) + 1i*sign(randn(1,ntr+D)); % Baseband signal n = 0.1*(randn(1,ntr+D) + 1i*randn(1,ntr+D)); % Noise signal r = filter(b,a,s)+n; % Received signal x = r(1+D:ntr+D); % Input signal (received signal) d = s(1:ntr); % Desired signal (delayed QPSK signal) mu = 0.1; % Step size po = 4; % Projection order offset = 0.05; % Offset for covariance matrix h = dsp.AffineProjectionFilter('Length', 32, ... 'StepSize', mu, 'ProjectionOrder', po, ... 'InitialOffsetCovariance',offset); [y,e] = h(x,d); subplot(2,2,1); plot(1:ntr,real([d;y;e])); title('In-Phase Components'); legend('Desired','Output','Error'); xlabel('time index'); ylabel('signal value'); subplot(2,2,2); plot(1:ntr,imag([d;y;e])); title('Quadrature Components'); legend('Desired','Output','Error'); xlabel('time index'); ylabel('signal value'); subplot(2,2,3); plot(x(ntr-100:ntr),'.'); axis([-3 3 -3 3]); title('Received Signal Scatter Plot'); axis('square'); xlabel('Real[x]'); ylabel('Imag[x]'); grid on; subplot(2,2,4); plot(y(ntr-100:ntr),'.'); axis([-3 3 -3 3]); title('Equalized Signal Scatter Plot'); axis('square'); xlabel('Real[y]'); ylabel('Imag[y]'); grid on; ```

## 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\left(n\right)=\left(\begin{array}{ccc}u{\left(n\right)}_{}& \dots & u\left(n-L\right)\\ ⋮& \ddots & ⋮\\ u{\left(n-N\right)}_{}& \cdots & u\left(n-L-N\right)\end{array}\right)=\left(\begin{array}{ccc}u\left(n\right)& u\left(n-1\right)& \cdots \begin{array}{cc}& u\left(n-L\right)\end{array}\end{array}\right)\\ yap\left(n\right)={U}^{T}ap\left(n\right)w\left(n\right)=\left(\begin{array}{c}y\left(n\right)\\ ·\\ ·\\ ·\\ y\left(n-L\right)\end{array}\right)\\ dap\left(n\right)=\left(\begin{array}{c}d\left(n\right)\\ ·\\ ·\\ ·\\ d\left(n-L\right)\end{array}\right)\\ eap\left(n\right)=dap\left(n\right)-yap\left(n\right)=\left(\begin{array}{c}e\left(n\right)\\ ·\\ ·\\ ·\\ e\left(n-L\right)\end{array}\right)\\ w\left(n\right)=w\left(n-1\right)+\mu Uap\left(n\right){\left(}^{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:

VariableDescription
nThe current time index
u(n)The input sample at step n
Uap(n)The matrix of the last L+1 input signal vectors
d(n)The desired signal
e(n)The error at step n
LThe projection order
NThe 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