www.pudn.com > Chap_5_EQ.rar > run_lms_eq.m


function  lms_eq(rp) 
 
 
%str_update=['Running ->   eigenvalue spread: ' num2str(rp.T)  '   results file: ' num2str(rp.name)]; 
%disp(str_update); 
 
 
% Section 9.7, Adaptive Filter Theory, 3rd edition 
% Adaptive equalization 
 
seed  = 0:(rp.Nruns-1); 
h   = [0.5*(1+cos((2*pi/rp.T)*((1:3) - 2)))]; 
 
Npred = rp.Ndata - 1 - rp.p; 
E  = zeros(Npred, rp.Nruns); 
Wx = zeros(rp.p, Npred); 
 
for iter = 1:rp.Nruns, 
             
    rand( 'seed', seed(iter)); 
    randn('seed', seed(iter)); 
     
    a  = 2*(rand(rp.Ndata, 1) > 0.5) - 1; 
    Xi = conv(a, h); 
 
    % account for shift in input sequence introduced by 
    % convolution with h and offset 1 addressing in MATLAB 
     
    Xi = Xi((length(h)+1):length(Xi)); 
    Xi = Xi + sqrt(rp.var_v)*randn(length(Xi), 1); 
     
    [Xi, Y] = mksstrndata(Xi, rp.p); 
    Y = a((rp.tau+1) : rp.Ndata); 
 
    lms_eq; 
    E(:, iter) = e; 
    Wx = Wx + Wo; 
     
end; % for iter 
 
Wx = Wx / rp.Nruns; 
 
eval(['save ' rp.name])