[转帖]RLS算法程序
%RLS_S.m%RLS algorithm
%static status
%synchronous CDMA
%channel: White Gaussis Noise
function = RLS_S(b,N,K,step,yN_step,S,SNR)
%multiuser detection
yyN_step=(yN_step);
delta=1e-2;
P=1/delta*eye(N);%P=1/R
lamda=0.997;
for i=1:step
KK=P*yyN_step(:,i)/(lamda+yyN_step(:,i)'*P*yyN_step(:,i));
P=1/lamda*(P-KK*yyN_step(:,i)'*P);
h=P*S(1,:).';
c=h/(S(1,:)*h);
P1(i)=abs( (c.'*S(1,:).')^2 );
P_i_n(i)=abs( ( c.'*(yyN_step(:,i)-b(1,i)*S(1,:).') )^2 );
%SINR(i)=P1/P_i_n;
y(i)=sign(real(c.'*yyN_step(:,i)));
E=abs( (c.'*yyN_step(:,i))^2 );
E_min=1;
E_ex(i)=E-E_min;
end
correct=(y==b(1,:));
%plot(SINR); %RLS_S.m
%RLS algorithm
%static status
%synchronous CDMA
%channel: White Gaussis Noise
function = RLS_D(b,N,K,step,yN_step,S,SNR,P)
%multiuser detection
lamda=0.997;
PP=P;
for i=1:step
KK=PP*yN_step(:,i)/(lamda+yN_step(:,i).'*PP*yN_step(:,i));
PP=1/lamda*(PP-KK*yN_step(:,i).'*PP);
h=PP*S(1,:).';
c=h/(S(1,:)*h);
P1(i)=(c.'*S(1,:).')^2;
P_i_n(i)=( c.'*(yN_step(:,i)-b(1,i)*S(1,:).') )^2;
%SINR(i)=P1/P_i_n;
y(i)=sign(c.'*yN_step(:,i));
E=(c.'*yN_step(:,i))^2;
E_min=1;
E_ex(i)=E-E_min;
end
correct=(y==b(1,:));
%plot(SINR); 学习下,谢谢分享,:lol :@)
页:
[1]