From: Eshwar_86 on
I have a really elementary doubt in the lms algorithm. Here's the code i
have written, and i'm simply unable to find out why its not working! The
theory seems simple enough. Will appreciate any feedback. Thank you

w = zeros(32,1);
u = zeros(1,32);
e = zeros(1,32);
M = 32;

mu = 0.008;
for i=1:(500-M)
u = x(i+M:-1:i+1);
e(i) = d(i) - u*w;
w = w + mu*conj(e(i))*u';
end



From: Muzaffer Kal on
On Mon, 10 May 2010 10:34:34 -0500, "Eshwar_86"
<s_eshwar44(a)n_o_s_p_a_m.yahoo.com> wrote:

>I have a really elementary doubt in the lms algorithm. Here's the code i
>have written, and i'm simply unable to find out why its not working! The
>theory seems simple enough. Will appreciate any feedback. Thank you
>
>w = zeros(32,1);
>u = zeros(1,32);
>e = zeros(1,32);
>M = 32;
>
>mu = 0.008;
>for i=1:(500-M)
> u = x(i+M:-1:i+1);
> e(i) = d(i) - u*w;
> w = w + mu*conj(e(i))*u';
>end
>
>

Try adding
w(15) = 1;
to your code before the loop.
--
Muzaffer Kal

DSPIA INC.
ASIC/FPGA Design Services

http://www.dspia.com
From: HardySpicer on
On May 11, 3:34 am, "Eshwar_86" <s_eshwar44(a)n_o_s_p_a_m.yahoo.com>
wrote:
> I have a really elementary doubt in the lms algorithm. Here's the code i
> have written, and i'm simply unable to find out why its not working! The
> theory seems simple enough. Will appreciate any feedback. Thank you
>
> w = zeros(32,1);
> u = zeros(1,32);
> e = zeros(1,32);
> M = 32;
>
> mu = 0.008;
> for i=1:(500-M)
>     u = x(i+M:-1:i+1);
>     e(i) = d(i) - u*w;
>     w = w + mu*conj(e(i))*u';
> end

Where is the dynamic system you are estimating the weights of? Where
do you shuffle the regression vector? ie take the next sample of u and
put it into X


Hardy
From: cpshah99 on
>I have a really elementary doubt in the lms algorithm. Here's the code i
>have written, and i'm simply unable to find out why its not working! The
>theory seems simple enough. Will appreciate any feedback. Thank you
>
>w = zeros(32,1);
>u = zeros(1,32);
>e = zeros(1,32);
>M = 32;
>
>mu = 0.008;
>for i=1:(500-M)
> u = x(i+M:-1:i+1);
> e(i) = d(i) - u*w;
> w = w + mu*conj(e(i))*u';
>end
>

the first line in ur loop u = x(i+M:-1:i+1); is wrong. I think it should be
u=x(i+M-1:-1:i);

change this and see if it is working.

Chintan
From: cpshah99 on
>>I have a really elementary doubt in the lms algorithm. Here's the code i
>>have written, and i'm simply unable to find out why its not working! The
>>theory seems simple enough. Will appreciate any feedback. Thank you
>>
>>w = zeros(32,1);
>>u = zeros(1,32);
>>e = zeros(1,32);
>>M = 32;
>>
>>mu = 0.008;
>>for i=1:(500-M)
>> u = x(i+M:-1:i+1);
>> e(i) = d(i) - u*w;
>> w = w + mu*conj(e(i))*u';
>>end
>>
>
>the first line in ur loop u = x(i+M:-1:i+1); is wrong. I think it should
be
>u=x(i+M-1:-1:i);
>
>change this and see if it is working.
>
>Chintan
>

Forgot one more point.

If your data vector 'x' is complex then in the update step it should be
w=w+mu*conj(e(i))*u.';

Chintan