main content

compute output, error and coefficients using affine projection (ap) algorithm -凯发k8网页登录

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:

  1. create the dsp.affineprojectionfilter object and set its properties.

  2. 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

description

apf = dsp.affineprojectionfilter returns an adaptive fir filter system object, 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.

example

apf = dsp.affineprojectionfilter(len) returns an affine projection filter object with the length property set to len.

example

apf = dsp.affineprojectionfilter(name,value) 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.

properties

unless otherwise indicated, properties are nontunable, which means you cannot change their values after calling the object. objects lock when you call them, and the function unlocks them.

if a property is tunable, you can change its value at any time.

for more information on changing property values, see .

specify the method used to calculate filter coefficients as direct matrix inversion, recursive matrix update, block direct matrix inversion. this property is nontunable.

specify the length of the fir filter coefficients vector as a scalar positive integer value. this property is nontunable.

data types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

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. this property is nontunable.

data types: double

specify the affine projection step size factor as a scalar nonnegative numeric value between 0 and 1, both inclusive. setting the step size equal to one provides the fastest convergence during adaptation.

tunable: yes

data types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | logical

specify the initial values of the fir adaptive filter coefficients as a scalar or a vector of length equal to the length property value.

tunable: yes

data types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

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.

tunable: yes

dependencies

this property is applicable only if the method property is set to direct matrix inversion or block direct matrix inversion.

data types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

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.

tunable: yes

dependencies

this property is applicable only if the method property is set to recursive matrix update.

data types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

specify the initial values of the correlation coefficients of the fir filter as a scalar or a vector of length equal to projectionorder1.

tunable: yes

dependencies

this property is applicable only if the method property is set to recursive matrix update.

data types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

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).

tunable: yes

usage

description

example

[y,err] = apf(x,d) filters the input 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

the signal to be filtered by the affine projection filter. the input, x, and the desired signal, d, must have the same size and data type.

the input can be a variable-size signal. you can change the number of elements in the column vector even when the object is locked. the system object locks when you call the object to run its algorithm.

data types: single | double
complex number support: yes

the affine projection filter adapts its coefficients to minimize the error, err, and converge the input signal x to the desired signal d as closely as possible.

the input, x, and the desired signal, d, must have the same size and data type.

the desired signal can be a variable-size signal. you can change the number of elements in the column vector even when the object is locked. the system object locks when you call the object.

data types: single | double
complex number support: yes

output arguments

filtered output, returned as a scalar or a column vector. the object adapts its filter coefficients to converge the input signal x to match the desired signal d. the filter outputs the converged signal.

data types: single | double
complex number support: yes

difference between the output signal y and the desired signal d, returned as a scalar or a column vector. the objective of the affine projection filter is to minimize this error. the object adapts its coefficients to converge towards optimal filter coefficients that produce an output signal that matches closely with the desired signal. to access the affine projection filter coefficients, call apf.coefficients after you pass the input and desired signal to the object.

data types: single | double
complex number support: yes

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)
estimated mean squared error for adaptive filters
run system object algorithm
release resources and allow changes to system object property values and input characteristics
reset internal states of system object

examples

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
apf = dsp.affineprojectionfilter('length', 32, ...
    'stepsize', mu, 'projectionorder', po, ...
    'initialoffsetcovariance',offset);
[y,e] = apf(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;

figure contains 4 axes objects. axes object 1 with title in-phase components, xlabel time index, ylabel signal value contains 3 objects of type line. these objects represent desired, output, error. axes object 2 with title quadrature components, xlabel time index, ylabel signal value contains 3 objects of type line. these objects represent desired, output, error. axes object 3 with title received signal scatter plot, xlabel real[x], ylabel imag[x] contains a line object which displays its values using only markers. axes object 4 with title equalized signal scatter plot, xlabel real[y], ylabel imag[y] contains a line object which displays its values using only markers.

ha = fir1(31,0.5);
% fir system to be identified 
fir = dsp.firfilter('numerator',ha); 
iir = dsp.iirfilter('numerator',sqrt(0.75),...
        'denominator',[1 -0.5]);
x = iir(sign(randn(2000,25))); 
% observation noise signal 
n = 0.1*randn(size(x));         
% desired signal 
d = fir(x) n;  
% filter length 
l = 32;  
% affine projection filter step size. 
mu = 0.008;
% decimation factor for analysis
% and simulation results 
m  = 5;                             
                                    
apf = dsp.affineprojectionfilter(l,'stepsize',mu); 
[simmse,meanwsim,wsim,traceksim] = msesim(apf,x,d,m);
plot(m*(1:length(simmse)),10*log10(simmse));
xlabel('iteration'); ylabel('mse (db)');
% plot the learning curve for affine projection filter 
% used in system identification
title('learning curve')

figure contains an axes object. the axes object with title learning curve, xlabel iteration, ylabel mse (db) contains an object of type line.

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:

uap(n)=(u(n)u(nl)u(nn)u(nln))=(u(n)u(n1)u(nl))yap(n)=utap(n)w(n)=(y(n)···y(nl))dap(n)=(d(n)···d(nl))eap(n)=dap(n)yap(n)=(e(n)···e(nl))w(n)=w(n1) μuap(n)(uaph(n)uap(n) c)1eap

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
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
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.

extended capabilities

version history

introduced in r2013a

see also

objects

网站地图