0
$\begingroup$

I’m trying to understand the conception of function maxstep

The foundation of this function is function firwiener with input parameters: length of adaptive filter, samples of input signal, which returns dLam, kurt

and then step size calculated as:

*mumaxmse = 2/(max(dLam)*(kurt+2)+sum(dLam));*  

Though, with some types of input data this function works correctly ("x" in Example2), and with some types ("x" in Example 1) incorrectly

  1. Why it happens?
  2. How to estimate mumaxmse at Example 1?

Example 1

 D = 16; % Number of delay samples 
 b = exp(1j*pi/4)*[-0.7 1]; % Numerator coefficients 
 a = [1 -0.7]; % Denominator coefficients 
 ntr= 1000; % Number of iterations 
 s = sign(randn(1,ntr+D)) + 1j*sign(randn(1,ntr+D)); % QPSK signal 
 n = 0.1*(randn(1,ntr+D) + 1j*randn(1,ntr+D)); % Noise signal 
 r = filter(b,a,s)+n; % Received signal 
 x = r(1+D:ntr+D); % Input signal (received signal) 
 L = 32; % filter length 
[~,~,~,~,~,dLam,kurt] = firwiener(32-1,x,x); % Third input is 'dummy'
 mumaxmse = 2/(max(dLam)*(kurt+2)+sum(dLam));  %  Compute MSE Step size bound

Here mumaxmse is NaN because of kurt (kurt is NaN)

====================================== Example 2

 x = randn(2000,1)+sqrt(-1)*randn(2000,1); 
 d = x; 
 obj = fdesign.lowpass('n,fc',31,0.5); 
 hd = design(obj,'window'); % FIR filter to identified. 
 coef = cell2mat(hd.coefficients); % Convert cell array to matrix. 
 x(:,1) = filter(sqrt(0.75),[1 -0.5],sign(randn(size(x,1),1))); 
[~,~,~,~,~,dLam,kurt] = firwiener(32-1,x,x); % Third input is 'dummy'
mumaxmse = 2/(max(dLam)*(kurt+2)+sum(dLam));  %  Compute MSE Step size bound

And here mumaxmse is correctly (kurt not NaN)

+++++From Matab++++++++++++
%MAXSTEP  Maximum step size for adaptive filter convergence.
%
%   MUMAX = MAXSTEP(H,X) predicts a bound on the step size to  provide
%   convergence of the mean values of the adaptive filter coefficients.  
%
%   The columns of the matrix X contain individual input signal sequences.
%   The signal set is assumed to have zero mean or nearly so.  
% 
%   [MUMAX,MUMAXMSE] = MAXSTEP(H,X) predicts a bound on the adaptive
%   filter step size to provide convergence of the adaptive filter
%   coefficients in mean square.  
%
%   See also MSEPRED, MSESIM, FILTER.

%   Author(s): S.C. Douglas
%   Copyright 1999-2009 The MathWorks, Inc.
%   $Revision: 1.6.4.2 $  $Date: 2009/10/16 04:52:21 $

error(nargchk(2,2,nargin,'struct'));

xt = x(:);                          %  Stack input sequences into one vector

%  Compute Step size bound for convergence in the mean
L = length(h.Coefficients);              %  Length of coefficient vector
mumax = 2/(mean(xt.*xt)*L);         %  Calculate sufficient Step size bound

if (nargout > 1)
    [~,~,~,~,~,dLam,kurt] = firwiener(L-1,x,x); % Third input is 'dummy'
    mumaxmse = 2/(max(dLam)*(kurt+2)+sum(dLam));  %  Compute MSE Step size bound
    if (h.StepSize > mumaxmse/2) || (h.StepSize <= 0)       %  Test h.StepSize and warn if outside reasonable limits
        warning(generatemsgid('InvalidStepSize'), ...
            ['Step size is not in the range ',...
            '0 < mu < mumaxmse/2: \n',...
            'Erratic behavior might result.']);
    end
end



+++From MATLAB++++++++++++++++++++++++++++++++
function [W,R,P,V,Lam,dLam,kurt] = firwiener(N,x,y)
%FIRWIENER Optimal FIR Wiener filter.
%   B = FIRWIENER(N,X,Y) computes the optimal FIR Wiener filter of order N,
%   given two (stationary) random signals in column vectors X and Y.
%
%   B = FIRWIENER(N,X,Y) where X and Y are matrices, averages over the
%   columns of X and Y when computing the Wiener filter.

%   Author(s): Scott C. Douglas
%   Copyright 1999-2009 The MathWorks, Inc.
%   $Revision: 1.1.4.3 $  $Date: 2009/09/03 04:50:31 $


[ntr,L] = size(x);              
r = zeros(2*(N+1)-1,1);             %  Initial autocorrelation vector
p = r;                          %  Initial cross correlation vector
for k=1:L
    r = r + xcorr(x(:,k),N);  %  Calculate (k)th autocorrelation and accumulate
    p = p +  xcorr(y(:,k),x(:,k),N);  %  Calculate (k)th cross correlation and     accumulate
end
R = toeplitz(r(N+1:2*(N+1)-1))/(L*ntr);  %  (L x L) input autocorrelation matrix
P = p(N+1:2*(N+1)-1).'/(L*ntr);          %  (1 x L) cross correlation vector
W = P/R;

if nargout > 3,
    [V,Lam] = eig(R);               %  Find eigenvalue decomposition of R
    dLam = diag(Lam);               %  Specify eigenvalue vector
    if nargout > 6,
        kurt = 0;                   %  Initial kurtosis value
        for i=1:N
            for k=1:L
                xv = filter(V(:,i),1,x(:,k));  %  Calculate (k)th eigenvector filtered signal
                kurt = kurt + mean(xv.^4)/mean(xv.^2)^2 - 3;  %  Estimate kurtosis value

            end
        end
        kurt = kurt/(L*N);              %  Average kurtosis value of eigenvector filtered signals
    end
end
$\endgroup$
  • $\begingroup$ Where are these functions from? Give us some links and background info so that people wouldn't need to spend time figuring out what you're actually asking about. $\endgroup$ – Phonon Oct 5 '12 at 15:09
  • $\begingroup$ All from Matlab $\endgroup$ – Timur Oct 6 '12 at 9:10
  • $\begingroup$ I don't know whether you want to determine the maximum step size that assures convergence of the LMS algorithm (as it seems from the question's title) or whether you want to make the function maxstep() work properly. However, the maximum step size that allows for convergence depends on the largest eigenvalue of the correlation matrix of the input vectors. This is detailed, e.g., in Simon Haykin's "Adaptive Filter Theory". $\endgroup$ – applesoup Aug 27 '17 at 18:37

Your Answer

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

Browse other questions tagged or ask your own question.