main content

fast transversal least-凯发k8网页登录

fast transversal least-squares fir adaptive filter

description

the dsp.fasttransversalfilter computes output, error and coefficients using a fast transversal least-squares fir adaptive filter.

to implement the adaptive fir filter object:

  1. create the dsp.fasttransversalfilter 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

ftf = dsp.fasttransversalfilter returns a system object™, ftf, which is a fast transversal, least-squares fir adaptive filter. this system object computes the filtered output and the filter error for a given input and desired signal.

example

ftf = dsp.fasttransversalfilter(len) returns a dsp.fasttrasversalfilter system object with the length property set to len.

ftf = dsp.fasttransversalfilter(name,value) returns a dsp.fasttransversalfilter system object with each specified property set to the specified value.

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 either 'fast transversal least-squares' or 'sliding-window fast transversal least-squares'. for algorithms used to implement these two different methods, refer to [1]. this property is nontunable.

specify the length of the fir filter coefficients vector as a positive integer value.

data types: double

specify the width of the sliding window as a positive integer value greater than or equal to the length property value. the default vale is the value of the length property.

dependencies

this property applies only if the method property is set to 'sliding-window fast transversal least-squares'.

data types: double

specify the fast transversal filter forgetting factor as a positive scalar in the range (0,1]. setting this value to 1 denotes infinite memory while filter adaptation. setting this property value to 1 denotes infinite memory while adapting to find the new filter. for best results, set this property to a value that lies in the range [1-0.5/l,1], where l is the length property value.

tunable: yes

dependencies

this property applies only if the method property is set to 'fast transversal least-squares'.

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

specify the initial value of the forward and backward prediction error vectors as a positive numeric scalar. this scalar should be sufficiently large to maintain stability and prevent an excessive number of kalman gain rescues.

tunable: yes

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

specify the initial value of the conversion factor of the fast transversal filter.

the value of this property depends on the method property. if method is set to:

  • 'fast transversal least-squares' –– this property must be a positive numeric value less than or equal to 1

  • 'sliding-window fast transversal least-squares' –– this property must be a two-element numeric vector. the first element of this vector must lie within the range [0,1], and the second element must be less than or equal to -1. in this case, the default value is [1,-1].

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 value of the length property.

tunable: yes

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

specify whether to lock the filter coefficient values. by default, the value of this property is false, and the object continuously updates the filter coefficients. if this property is set to true, the filter coefficients do not update, and their values remain the same.

tunable: yes

usage

description

example

[y,err] = ftf(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.

input arguments

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

the data 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 fast transversal filter adapts its filter weights, wts, to minimize the error, err, and converge the input signal x to the desired signal d as closely as possible. you can access the current filter weights by calling ftf.coefficients, where ftf is the fast transversal filter object.

the input and the desired signal 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 to run its algorithm.

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 weights to converge the input signal x to match the desired signal d. the filter outputs the converged signal.

data types: single | double

difference between the output signal y and the desired signal d, returned as a scalar or a column vector. the data type of err matches the data type of y. the objective of the adaptive filter is to minimize this error. the object adapts its weights to converge toward optimal filter weights that produce an output signal that matches closely with the desired signal.

data types: single | double

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

system identification is the process of identifying the coefficients of an unknown system using an adaptive filter. the general overview of the process is shown in . the main components involved are:

  • the adaptive filter algorithm.

  • an unknown system or process to adapt to. in this example, the filter designed by fir1 is the unknown system.

  • appropriate input data to exercise the adaptation process. in a generic system identification model, the desired signal d(k) and the input signal x(k) are used to exercise the adaptation process.

the objective of the adaptive filter is to minimize the error signal between the output of the adaptive filter y(k) and the output of the unknown system (or the system to be identified) d(k). once the error signal is minimized, the adapted filter resembles the unknown system. the coefficients of both the filters match closely.

unknown system

create a dsp.firfilter object that represents the system to be identified. use the fir1 function to design the filter coefficients. the designed filter is a 10th order lowpass digital filter with a cutoff frequency of 0.25.

filt = dsp.firfilter;
filt.numerator = fir1(10,.25)
filt = 
  dsp.firfilter with properties:
            structure: 'direct form'
      numeratorsource: 'property'
            numerator: [-0.0039 1.7585e-18 0.0321 0.1167 0.2207 0.2687 0.2207 0.1167 0.0321 1.7585e-18 -0.0039]
    initialconditions: 0
  show all properties

pass the signal x to the fir filter. the desired signal d is the sum of the output of the unknown system (fir filter) and an additive noise signal n.

x = randn(1000,1);
d = filt(x)   0.01*randn(1000,1);

adaptive filter

with the unknown filter designed and the desired signal in place, create and apply the fast transversal filter object to identify the unknown filter.

create a dsp.fasttransversalfilter object to represent an adaptive filter. set the length of the adaptive filter to 11 taps and a forgetting factor of 0.99.

ftf1 = dsp.fasttransversalfilter(11,...
    'forgettingfactor',0.99)
ftf1 = 
  dsp.fasttransversalfilter with properties:
                         method: 'fast transversal least-squares'
                         length: 11
               forgettingfactor: 0.9900
    initialpredictionerrorpower: 10
            initialcoefficients: 0
        initialconversionfactor: 1
               lockcoefficients: false

pass the primary input signal x and the desired signal d to the fast transversal filter. run the adaptive filter to determine the unknown system. the output y of the adaptive filter is the signal converged to the desired signal d, thereby minimizing the error e between the two signals.

[y,e] = ftf1(x,d);
w = ftf1.coefficients
w = 1×11
   -0.0043    0.0016    0.0308    0.1171    0.2204    0.2677    0.2210    0.1181    0.0323    0.0013   -0.0037

plot the results. the output signal matches the desired signal very closely making the error between the two close to zero.

subplot(2,1,1);
plot(1:1000,[d,y,e])
title('system identification of an fir filter');
legend('desired','output','error');
xlabel('time index');
ylabel('signal value');

the coefficients of the fir filter match very closely with the coefficients of the adapted filter, thereby confirming the convergence.

subplot(2,1,2); 
stem([filt.numerator; w].');
legend('actual','estimated'); 
xlabel('coefficient #'); 
ylabel('coefficient value');

figure contains 2 axes objects. axes object 1 with title system identification of an fir filter, xlabel time index, ylabel signal value contains 3 objects of type line. these objects represent desired, output, error. axes object 2 with xlabel coefficient #, ylabel coefficient value contains 2 objects of type stem. these objects represent actual, estimated.

references

[1] haykin, simon. adaptive filter theory, 4th ed. upper saddle river, nj: prentice hall, 2002.

extended capabilities

version history

introduced in r2013b

网站地图