Hi, I was going thru a code for implementing the NLMS algorithm. I had a few doubts about it. Why has the MATLAB 4 generator been called in the first 2 lines. Why is the order of the adaptive filter 32? Is it necessary to initially give a zero value to the weights of the filter.I didn't find any change in the convergence rate when i ran it with other non-zero initial values. There is a warning - log of zero for the first line when i ran it.Please reply ASAP. I know these doubts are very basic, but i have to get them clarified ASAP. The code is given below:- randn('seed', 0) ; rand('seed', 0) ; NoOfData = 8000 ; % Set no of data points used for training Order = 32 ; % Set the adaptive filter order Mu = 1.0 ; % Set the step-size constant x = randn(NoOfData, 1) ;% Input assumed to be white h = rand(Order, 1) ; % System picked randomly d = filter(h, 1, x) ; % Generate output (desired signal) % Initialize NLMS w = ones(Order,1) ; % NLMS Adaptation for n = Order : NoOfData D = x(n:-1:n-Order+1) ; d_hat(n) = w'*D ; e(n) = d(n) - d_hat(n) ; w = w + Mu*e(n)*D/(D'*D) ; w_err(n) = norm(h - w) ; end ; % Plot results figure ; plot(20*log10(abs(e))) ; title('Learning Curve') ; xlabel('Iteration Number') ; ylabel('Output Estimation Error in dB') ; figure ; semilogy(w_err) ; title('Weight Estimation Error') ; xlabel('Iteration Number') ; ylabel('Weight Error in dB') ; |