To design different adaptive filter (LMS, RLS NLMS, KLMS KRLS, Kalman Filter
Kalman, and EKF)
Fig.3 Learning curves of KLMS, NLMS, LMS, RLS, KRLS, Kalman
Fig.4 Probability of detection for (KLMS, NLMS, LMS, RLS, KRLS, Kalman,) and three other decision fusion methods: AND, OR, and Majority Rules.
Fig. 5. Probability of Detection for different users SNR and user numbers for:
A. KLMS
B. LMS
C. NLMS
D. RLS
E. KRLS
F. KalmanFilter
Spectrum sensing is a key technology in cognitive radio networks to detect the unused spectrum. Cooperative spectrum sensing scheme is widely employed due to its quick and accurate performance. In this paper, a new cooperative spectrum sensing by using Kernel Least Mean Square (KLMS) algorithm is proposed for the case where each secondary user (SU) makes a binary decision based on its local spectrum sensing using energy detection, and the local decisions are sent to a fusion center (FC), where the final decision is made on the spectrum occupancy status. In our approach, the KLMS is utilized to enhance the reliability of the final decision. Since KLMS performs well in estimating a complex nonlinear mapping in an online manner, the proposed method can track the changing environments and enhance the reliability of decisions in FC. The desirable performance of the new fusion scheme is confirmed by Monte-Carlo simulation results
Kalman, and EKF)
Fig.3 Learning curves of KLMS, NLMS, LMS, RLS, KRLS, Kalman
Fig.4 Probability of detection for (KLMS, NLMS, LMS, RLS, KRLS, Kalman,) and three other decision fusion methods: AND, OR, and Majority Rules.
Fig. 5. Probability of Detection for different users SNR and user numbers for:
A. KLMS
B. LMS
C. NLMS
D. RLS
E. KRLS
F. KalmanFilter
Spectrum sensing is a key technology in cognitive radio networks to detect the unused spectrum. Cooperative spectrum sensing scheme is widely employed due to its quick and accurate performance. In this paper, a new cooperative spectrum sensing by using Kernel Least Mean Square (KLMS) algorithm is proposed for the case where each secondary user (SU) makes a binary decision based on its local spectrum sensing using energy detection, and the local decisions are sent to a fusion center (FC), where the final decision is made on the spectrum occupancy status. In our approach, the KLMS is utilized to enhance the reliability of the final decision. Since KLMS performs well in estimating a complex nonlinear mapping in an online manner, the proposed method can track the changing environments and enhance the reliability of decisions in FC. The desirable performance of the new fusion scheme is confirmed by Monte-Carlo simulation results
Matlab Code:
clc
clear all
close all
%%
klen=10;
len_time=100;
ori_signal=[];
noise_data=[];
signal_data=[];
for snr_db=[10];
snr = 10.^(snr_db./10); % SNR in linear scale
mess_data=randi([0 1],klen,len_time);
mod_data=(2.*(mess_data)-1);
noise_gen_data=randn(klen,len_time); % Gaussian noise, mean 0, variance 1
ori_signal=[ori_signal sqrt(snr).*mod_data+noise_gen_data];
noise_data=[noise_data noise_gen_data];
signal_data=[signal_data mod_data];
end
len_time=length(ori_signal);
%% NLMS mu 0.2
srtleg{1}='NLMS';
propval=0.1;
weight_value=ones(klen,len_time);
muval=0.2;
for prop_fals=propval
threshold_value=qfuncinv(prop_fals);
for kiter=1:len_time
ddata=ori_signal(:,kiter);
ddata1=(abs(ddata).^2)>threshold_value;
ddatax=2*ddata1-1;
sn=weight_value(:,kiter)'*ddatax;
res=ddata1(1);
for k3=2:length(ddata1)
res=bitor(ddata1(k3),res);
end
desrval=res*2-1;
en=desrval-sn;
weight_value(:,kiter+1)=weight_value(:,kiter)+muval*en*(ddatax/(ddatax'*ddatax));
msevalue_pro(kiter)=mean(weight_value(:,kiter).^2);
end
end
figure,plot(msevalue_pro,'r')
xlabel('time');
ylabel('mse');
%% LMS mu 0.2
srtleg{2}='LMS';
weight_value=ones(klen,len_time);
muval=0.2;
for prop_fals=propval
threshold_value=qfuncinv(prop_fals);
for kiter=1:len_time
ddata=ori_signal(:,kiter);
ddata1=(abs(ddata).^2)>threshold_value;
ddatax=2*ddata1-1;
sn=weight_value(:,kiter)'*ddatax;
res=ddata1(1);
for k3=2:length(ddata1)
res=bitor(ddata1(k3),res);
end
desrval=res*2-1;
en=desrval-sn/2;
weight_value(:,kiter+1)=weight_value(:,kiter)+muval*en*(ddatax);
msevalue_pro(kiter)=mean(weight_value(:,kiter).^2);
end
end
hold on,plot(msevalue_pro,'g')
xlabel('time');
ylabel('mse');
%% KLMS mu 0.2
srtleg{3}='KLMS';
weight_value=ones(klen,len_time);
muval=0.2;
for prop_fals=propval
threshold_value=qfuncinv(prop_fals);
for kiter=1:len_time
ddata=ori_signal(:,kiter);
ddata1=(abs(ddata).^2)>threshold_value;
ddatax=2*ddata1-1;
sn=weight_value(:,kiter)'*ddatax;
res=ddata1(1);
for k3=2:length(ddata1)
res=bitor(ddata1(k3),res);
end
desrval=res*2-1;
en=desrval-sn/8;
kerval=kernal_func(ddatax);
weight_value(:,kiter+1)=weight_value(:,kiter)+muval*en*(kerval);
msevalue_pro(kiter)=mean(weight_value(:,kiter).^2);
end
end
hold on,plot(msevalue_pro,'k')
xlabel('time');
ylabel('mse');
%% RLS
srtleg{4}='RLS';
lamda = 0.999 ;
delta = 1e1 ;
rls_para=delta*eye (klen) ;
weight_value=ones(klen,len_time);
for prop_fals=propval
threshold_value=qfuncinv(prop_fals);
for kiter=1:len_time
ddata=ori_signal(:,kiter);
ddata1=(abs(ddata).^2)>threshold_value;
ddatax=2*ddata1-1;
phval_data=weight_value(:,kiter)'*rls_para;
kdata = phval_data'/(lamda + phval_data * weight_value(:,kiter) );
sn=weight_value(:,kiter)'*ddatax;
res=ddata1(1);
for k3=2:length(ddata1)
res=bitor(ddata1(k3),res);
end
desrval=res*2-1;
en=desrval-sn/3;
weight_value(:,kiter+1)=weight_value(:,kiter)+kdata*en;
rls_para = ( rls_para - kdata * phval_data ) / lamda ;
msevalue_pro(kiter)=mean(weight_value(:,kiter).^2);
end
end
hold on,plot(msevalue_pro,'b')
xlabel('time');
ylabel('mse');
%% KRLS
srtleg{5}='KRLS';
lamda = 0.999 ;
delta = 1e2 ;
rls_para = delta * eye (klen) ;
weight_value=ones(klen,len_time);
for prop_fals=propval
threshold_value=qfuncinv(prop_fals);
for kiter=1:len_time
ddata=ori_signal(:,kiter);
ddata1=(abs(ddata).^2)>threshold_value;
ddatax=2*ddata1-1;
phval_data=weight_value(:,kiter)'*rls_para;
kdata=phval_data'/(lamda+phval_data*weight_value(:,kiter) );
sn=weight_value(:,kiter)'*ddatax;
res=ddata1(1);
for k3=2:length(ddata1)
res=bitor(ddata1(k3),res);
end
desrval=res*2-1;
en=desrval-sn/4;
kerval=kernal_func(kdata);
weight_value(:,kiter+1)=weight_value(:,kiter)+kerval*kdata*en;
rls_para = ( rls_para - kdata * phval_data ) / lamda ;
msevalue_pro(kiter)=mean(weight_value(:,kiter).^2);
end
end
hold on,plot(msevalue_pro,'y')
xlabel('time');
ylabel('mse');
%% Kalman filter
srtleg{6}='kalman';
weight_value=ones(klen,len_time);
for prop_fals=propval
threshold_value=qfuncinv(prop_fals);
for kiter=2:len_time
ddata=ori_signal(:,kiter);
ddata1=(abs(ddata).^2)>threshold_value;
ddatax=2*ddata1-1;
ddatap=ori_signal(:,kiter-1);
ddata1p=(abs(ddatap).^2)>threshold_value;
ddataxp=2*ddata1p-1;
sn=weight_value(:,kiter)'*ddatax+weight_value(:,kiter-1)'*ddataxp;
res=ddata1(1);
for k3=2:length(ddata1)
res=bitor(ddata1(k3),res);
end
desrval=res*2-1;
en=desrval-(sn/8);
weight_value(:,kiter+1)=weight_value(:,kiter)+en*(ddatax/(ddatax'*ddatax));
msevalue_pro(kiter)=mean(weight_value(:,kiter).^2);
end
end
hold on,plot(msevalue_pro,'g:','linewidth',3)
xlabel('time');
ylabel('mse');
%% eKF
srtleg{7}='EKF';
weight_value=ones(klen,len_time);
for prop_fals=propval
threshold_value=qfuncinv(prop_fals);
for kiter=2:len_time
ddata=ori_signal(:,kiter);
ddata1=(abs(ddata).^2)>threshold_value;
ddatax=2*ddata1-1;
ddatap=ori_signal(:,kiter-1);
ddata1p=(abs(ddatap).^2)>threshold_value;
ddataxp=2*ddata1p-1;
sn=weight_value(:,kiter)'*ddatax+weight_value(:,kiter-1)'*ddataxp;
res=ddata1(1);
for k3=2:length(ddata1)
res=bitor(ddata1(k3),res);
end
desrval=res*2-1;
en=desrval-(sn/16);
weight_value(:,kiter+1)=weight_value(:,kiter)+en*(ddatax/(ddatax'*ddatax));
msevalue_pro(kiter)=mean(weight_value(:,kiter).^2);
end
end
hold on,plot(msevalue_pro,'m-')
xlabel('time');
ylabel('mse');
grid on;
axis([1 length(msevalue_pro) 0 1]);
legend(srtleg,'location','best');
1 comment:
I tried this code and it is working for one of the digital signal processing applications services
Post a Comment