Looking for Matlab code for LMS and RLS
Here is the LMS and RLS matlab codes.....
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_sym(sqrt(2), xLen+200, 1); %x=real(x);
d = [zeros(D,1); x]; %take delay into consideration
y = conv(x,c); %y(1:D)=[]; %take delay into consideration
w=sqrt(sigma_w2)/2*(randn(length(y),1)+j*randn(length(y),1));
y=y+w;
ryy=y(101Len+100)'*y(101Len+100)/xLen h=zeros(hLen,1);
h(D+1)=1;
for ii=101Len+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:D)=[]; %take delay into consideration
w=sqrt(sigma_w2)/2*(randn(length(y),1)+j*randn(length(y),1));
y=y+w;
ryy=y(101Len+100)'*y(101Len+100)/xLen h=zeros(hLen,1);
h(D+1)=1;
Rinv=eye(hLen);
for ii=101Len+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))
hi.
Can anyone give me the C code for RLS?
what is the meaning of rand_sym, i cannot find it in the matlab program? Can you describe the detail of rand_sym? Or it exits in some toolBox?
Can you describe the detail of rand_sym?
- Output Impedance Of a Triple cascode
- LM567 morse code detector weird thing
- How come differential cascode structures affect on PA characteristics?
- [Moved]: near field to far field transformation code error
- Cascode LNA output impedance in cadence
- Need a Matlab Code For Parameter Extraction of Symmetric Coupled Resonator Filters
