Hi all, Anybody of you know how to use the matlab script provided in the book DSP using matlab. The script is about LMS equalizer algorithm and as follows: function [h,y] = lms(x,d,delta,N) % LMS Algorithm for Coefficient Adjustment %  % [h,y] = lms(x,d,delta,N) % h = estimated FIR filter % y = output array y(n) % x = input array x(n) % d = desired array d(n), length must be same as x % delta = step size % N = length of the FIR filter % M = length(x); y = zeros(1,M); h = zeros(1,N); for n = N:M x1= x(n:1:nN+1); y = h * x1.'; error = d(n)  y(n); h = h + delta*(error)*x1; end If i send the input array x =[1.03+1.002i 2.03+3i 2.06+3.32i 2.008+2.98i] and let say the desired array is [1+i 2+3i 2+3i 3+3i] and i used delta = 0.02 and N=4 how come the output only one and it seems the error become larger, and hence it does not reduce the error. Please explain about this and preferably with the example. Thanks Best regards, Kurniawan 

LMS Equalization
Started by ●February 26, 2003
Reply by ●February 27, 200320030227
Here is an example, x=randn(1,100); y=filter([1 2 3 4],1,x); [h,o]=lms(x,y,0.1,4); I got h = [1.0004 1.9998 2.9996 3.9996] I didnt try complex values. In your code replace line y = h * x1.'; with y(n) = h * x1.'; Navan  "Helmi Kurniawan <>" <> wrote: > Hi all, > > Anybody of you know how to use the matlab script > provided in the book > DSP using matlab. The script is about LMS equalizer > algorithm and as > follows: > > function [h,y] = lms(x,d,delta,N) > % LMS Algorithm for Coefficient Adjustment > %  > % [h,y] = lms(x,d,delta,N) > % h = estimated FIR filter > % y = output array y(n) > % x = input array x(n) > % d = desired array d(n), length must be same as > x > % delta = step size > % N = length of the FIR filter > % > M = length(x); y = zeros(1,M); > h = zeros(1,N); > for n = N:M > x1= x(n:1:nN+1); > y = h * x1.'; > error = d(n)  y(n); > h = h + delta*(error)*x1; > end > > If i send the input array x =[1.03+1.002i 2.03+3i > 2.06+3.32i > 2.008+2.98i] > > and let say the desired array is [1+i 2+3i 2+3i > 3+3i] > > and i used delta = 0.02 and N=4 how come the output > only one and it > seems the error become larger, and hence it does not > reduce the error. > > Please explain about this and preferably with the > example. > > Thanks > > Best regards, > Kurniawan __________________________________________________ 