I am fairly new to the signal processing world and that being said I have little to no experience. The problem that I am having is that I am not quite sure how to use dsp.RLSFilter. So far I have only used highpass filter and it was straight forward - I had to just decide on the cutting frequency, type of highpass and sampling frequency, whereas for the RLS filter I have a ton of parameters to choose from. For example, how to decide on the method to calculate the filter coefficients? Furthermore, in the documentation it is stated:

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

and in the example step is not used:

rls1 = dsp.RLSFilter(11, 'ForgettingFactor', 0.98);
filt = dsp.FIRFilter('Numerator',fir1(10, .25)); % Unknown System
x = randn(1000,1);                       % input signal
d = filt(x) + 0.01*randn(1000,1); % desired signal
[y,e] = rls1(x, d);
w = rls1.Coefficients;
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');
subplot(2,1,2); stem([filt.Numerator; w].');
xlabel('coefficient #'); ylabel('coefficient value');

So what is the difference between using step and using the method in the example? When I try using the same the same way as in the example I get the following error message: Array formation and parentheses-style indexing with objects of class 'dsp.RLSFilter' is not allowed. Use objects of class 'dsp.RLSFilter' only as scalars or use a cell array. I tried using num2cell on x and d, however, I had 0 success.


Unlike a standard high pass filter where you set a cut-off frequency and other design parameters for a fixed filter result with a pass band ripple, stop band rejection, phase response etc.. the "recursive least squares filter" is an adaptive filter commonly used for channel equalization.

As a high level working example of a LMS equalizer, please see my post here where I derived and used the Wiener-Hopf equations to solve for the LMS filter coefficients. This would be an approach to equalization when the coefficients are solved for a block of data and then applied; most applicable to fixed filtering solutions such as compensating for distortions introduced in the RF portion of a receiver (compensating for analog filters for example).

Compensating Loudspeaker frequency response in an audio signal

To adaptively solve for the same coefficients, such as compensating for changing channel effects, two common algorithms are referred to as "LMS: Least-Mean Squared" and "RLS: Recursive Least Squares". I compare the two in my slide copied below, and for more details please refer to the following references

Rappaport, T.S. Wireless Communications Principles and Practice, Second Edition, Prentice Hall 2002

Proakis, J. “Adaptive Equalization for TDMA Digital Mobile Radio,“ IEEE Transactions on Vehicular Technology, Vol. 40, No. 2 pp 333-341, May 1991

Sayed, Ali, Fundamentals of Adaptive Filtering, Wiley, 2003

Bingham, J.A.C., The Theory and Practice of Modem Design, 1988

Adaptive Algorithms

The comparison of the implementation for the LMS and RLS adaptive equalizer is shown in the figures below, where vectors are indicated by single bars and matrices with double bars:

LMS: Easy!

LMS Equalizer

RLS: Fast!

RLS Equalizer

Finally to note that a least-squares equalizing filter is NOT the best choice for a channel with severe frequency selective fading as noise enhancement will result where deep fading nulls occur. For this condition, a decision feedback equalizer is often a better choice if time-domain equalization is to be used.

  • $\begingroup$ A really good answer that covers perfectly the difference between LMS and RLS, sadly I cannot upvote it as in the dsp section I have no reputation. I do think that now I understand the way RLS works, however, I still have problems building the RLS filter with matlab to process the signals as in the dsp.RLSFilter command in matlab I can have multipe parameters that are briefly covered in the documentation + in the documentation it is said to use step and in the example it is done otherwise. $\endgroup$
    – filtfilt
    May 13 '17 at 13:45
  • $\begingroup$ @filtfilt Thanks, I think you can select it as the "right answer" if you like even if you don't have enough reputation, no? I will look at the documentation and see if "step" is obvious to me $\endgroup$ May 13 '17 at 13:58
  • $\begingroup$ @filtfilt Did you read this documentation mathworks.com/help/dsp/ref/dsp.rlsfilter-class.html and this specifically: mathworks.com/help/dsp/ref/dsp.rlsfilter.step.html $\endgroup$ May 13 '17 at 13:59
  • $\begingroup$ Exactly those 2 I read. What I used was: y = step(rlsFilt,x,d) recursively adapts the reference input, x, to match the desired signal, d, using the System object, rlsFilt. and it did not work. In the second link you gave, under examples it is done without step,however, as I mentioned at the begining that does not work for me as well and I get an error message. $\endgroup$
    – filtfilt
    May 13 '17 at 14:29
  • $\begingroup$ Refer to this as well mathworks.com/help/matlab/matlab_prog/… which states that "step" is just Matlab's way of calling methods on system objects (such aes rlsFilt) which can just as easily be called as it it were a function, for example y = rlsFilt(x,d). I haven't used this system object but assume that each step is one iteration and the algorithm takes several iterations to converge on the final result (this is an assumption but you can verify that). $\endgroup$ May 13 '17 at 15:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.