?? kalman01.m
字號:
%multiuser_dectect.m
clear all;
close all;
%gold squence
N=31;
step=2000;
K=10;
S1=[1 1 1 1 1 -1 -1 -1 1 1 -1 1 1 1 -1 1 -1 1 -1 -1 -1 -1 1 -1 -1 1 -1 1 1 -1 -1];%a(n)=a(2)+a(-1)
S2=[1 -1 -1 -1 -1 1 -1 1 1 -1 1 -1 1 -1 -1 -1 1 1 1 -1 1 1 1 1 1 -1 -1 1 -1 -1 1];%a(n)=a(3)+a(2)+a(1)+a(-1)
for i=1:N
SS(i,:)=(S1~=[S2(i:N),S2(1:i-1)]);
end
SS=SS*2-1;
S=SS(1:K,:);%K*N
C(1,:)=SS(1,:);
C(2:N,:)=rand(N-1,N)*2-1;
for i=2:N
rou=C(i,:)*C(1:i-1,:).'./dot(C(1:i-1,:),C(1:i-1,:),2).';
C(i,:)=C(i,:)-rou*C(1:i-1,:);
end
for i=1:N
C(i,:)=C(i,:)/sqrt(dot(C(i,:),C(i,:)));
end
C_null=C(2:N,:);
SINR_Kalman=zeros(1,step);
P1_Kalman=zeros(1,step);
P_i_n_Kalman=zeros(1,step);
E_ex_Kalman=zeros(1,step);
SNR_db=[20,30,30,30,30,30,40,40,40,50]; %SNR (in dB)
SNR=10.^(SNR_db./10);
A=sqrt(SNR./SNR(1));%1×K
delta=1e-2;
KK=eye(N-1);
w=zeros(N-1,1);
clear SNR_db SNR A K S noiseN_step Ab b yN_step;
K=10;
S=SS(1:K,:);%K*N
SNR_db=[20,30,30,30,30,30,50,40,40,40]; %SNR (in dB)
SNR=10.^(SNR_db./10);
A=sqrt(SNR./SNR(1));%1×K
%through the channel
b=zeros(K,600);
b=sign(rand(K,600)-0.5);
noiseN_step=randn(N,600); % Noise
noiseN_step=sqrt(K./SNR(1))*noiseN_step;
for i=1:K
Ab(i,:)=A(i)*b(i,:);
end
yN_step=(Ab.'*S).';
yN_step=yN_step+noiseN_step;
[P1_Kalman_temp(1:600),P_i_n_Kalman_temp(1:600),y,correct,E_ex_Kalman_temp(1:600),KK,w]=Kalman_D(b,N,K,600,yN_step,S,SS,C_null,SNR,KK,w);
P1_Kalman=P1_Kalman_temp;
P_i_n_Kalman=P_i_n_Kalman_temp;
E_ex_Kalman=E_ex_Kalman_temp;
SINR_Kalman=P1_Kalman./P_i_n_Kalman;
SINR_db_Kalman=10*log10(SINR_Kalman);
figure(1);
hold on;
plot(SINR_db_Kalman,'g');
E_ex_Kalman=E_ex_Kalman;
E_ex_Kalman=abs(E_ex_Kalman);
figure(2);
hold on;
plot(E_ex_Kalman,'g');
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -