LMS VS RLS of smart antenna matlab code

Status
Not open for further replies.

YongwonCho

Newbie level 1
Joined
Nov 24, 2009
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Republic of Korea
Activity points
1,297
hey guys.
I have a LMS VS RLS of smart antenna matlab code. Unfortuneatly, It doesn't work. Is there any help? T.T plz.....

LMS
xLen = 2000; %sequence length
hLen = 10; %filter length
sigma_w2=0.0; %AWGN power
D=0;
delta=0.06;
c = [1; 0.8]; %channel impulse response
x = rand(sqrt(2), xLen+200, 1); %x=real(x);
d = [zeros(D,1); x]; %take delay into consideration
y = conv(x,c); %y(1)=[]; %take delay into consideration
w=sqrt(sigma_w2)/2*(randn(length,1)+j*randn(length,1));
y=y+w;
ryy=y(101:xLen+100)'*y(101:xLen+100)/xLen h=zeros(hLen,1);
h(D+1)=1;
for ii=101:xLen+100 xhat(ii)=h.'*y(ii:-1:ii-hLen+1);
e(ii)=d(ii)-xhat(ii);
h=h+delta*e(ii)*conj(y(ii:-1:ii-hLen+1));
end
hopt=h eq=conv(c,hopt)
figure(1)
stem(abs(eq))
figure(2)
plot(10*log10(abs(e).^2))
figure(3) plot((abs(e).^2))

RLS
xLen = 2000; %sequence length
hLen = 10; %filter length
sigma_w2=0.0; %AWGN power
D=0;
weight=1;
c = [1; 0.8]; %channel impulse response
x = rand_sym(sqrt(2), xLen+200, 1); %x=real(x);
d = [zeros(D,1); x]; %take delay into consideration
y = conv(x,c); %y(1)=[]; %take delay into consideration
w=sqrt(sigma_w2)/2*(randn(length,1)+j*randn(length,1));
y=y+w;
ryy=y(101:xLen+100)'*y(101:xLen+100)/xLen h=zeros(hLen,1);
h(D+1)=1;
Rinv=eye(hLen);
for ii=101:xLen+100 yvec=y(ii:-1:ii-hLen+1);
xhat(ii)=h.'*yvec;
e(ii)=d(ii)-xhat(ii);
K=Rinv*conj(yvec)/(weight+yvec.'*Rinv*conj(yvec));
Rinv=(Rinv-K*yvec.'*Rinv)/weight;
h=h+K*e(ii);
end
hopt=h eq=conv(c,hopt)
figure(1)
stem(abs(eq))
figure(2)
plot(10*log10(abs(e).^2))
figure(3)
plot((abs(e).^2))
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…