Reply by Col Brown January 22, 20042004-01-22
Matlab code is all I have at the moment...pick your way through that
lot.  Aren't I nice?

col




function [y,h,e]=adapt_rls(x,desired,gamma,sigma,len,Ntrain,lock,init,wghts,M,chnl_len);

% Adaptive RLS Filter
% 
% [y,h,e]=adapt_rls(x,desired,gamma,sigma,len,Ntrain,lock,init,wghts,M,chnl_len)
% 
%   y      = output signal
%   h      = filter coefficients
%   e      = error signal
%   x      = input signal
%   d      = desired signal
%   mu     = step size
%   len    = filter length, positive integer. the centre tap is
asssumed to be
%   the reference tap
%
% Check Input/Output Arguments


% Initialise Output, Error & Filter Vectors
N=length(x);
filter_len=len;
if (wghts~=0)
  h = wghts;  
else
  % initialise main tap
  h = zeros(filter_len,1);
  h(ceil((filter_len + 1)/2)) = init;  
end
if (sigma == 0)
  sigma = cov(x);
end
% initialise output
y=zeros(N,1);
% initialise error
e=zeros(N,1);
% initialise data buffer
m=zeros(filter_len,1);
% construct autocorrelation matrix
p=sigma*eye(len);
% initialise gain vector
k=zeros(filter_len,1);
% filter data
for n=1:N
  m = [x(n);m(1:filter_len-1)]; % shift next input sample in  
  y(n) = h' * m; % compute output
  if (~lock & n > Ntrain)
    % disp('in sliced')    
    e(n) = mpsk_slicer(y(n),M)-y(n); % feedback decisions
  else
    e(n) = desired(n) - y(n); % else use pilot signal
    % disp('using pilot')     
  end
  % really we discard chnl_len-1 symbols, so this is correct
  if((n >= chnl_len & ~lock) | (n >= chnl_len & n <= Ntrain))
    division = 1 / (gamma + m' * p * m); % compute Kalman gain vector
    k = p * m * division;
    h = h + k * conj(e(n)); % update coefficients
    p = ( p - k * m' * p) / gamma; % update inverse correlation matrix
  end    
  
end




Rob Judd <judd@ob-wan.com> wrote in message news:<400E946D.473A8BCC@ob-wan.com>...
> Greetz, > > Can someone point me to an actual coded implementation of an RLS filter? > I've dug all over the net and all I keep turning up is professorial > papers full of maths, or ads for student DSP toolboxes. > > TIA, > > Rob VK3XVK > SDR-1000 project > http://www.flex-radio.com
Reply by Rob Judd January 21, 20042004-01-21
Greetz,

Can someone point me to an actual coded implementation of an RLS filter?
I've dug all over the net and all I keep turning up is professorial
papers full of maths, or ads for student DSP toolboxes.

TIA,

Rob VK3XVK
SDR-1000 project
http://www.flex-radio.com