认知无线电 能量检测
clear allclcclear figN=600; %采样个数Sim_Times=1000;%仿真次数 snr_avgdB =-10;%信噪比(dB值)snr_avg=10^(snr_avgdB/10);%信噪比Dn=1; %噪声功率,高斯噪声的方差Ds=snr_avg*Dn;%信号功率F0=1;Fs=5;Pf=0:0.02:1-0.02;% Pf=0.02;Over_Num_awgn=zeros(1,length(Pf));Pd=zeros(1,length(Pf));for i=1:length(Pf) i for kk = 1:Sim_Times t = (kk-1)*N+1:kk*N; %高斯信号 Single1=sqrt(Ds) * randn(1,N); %产生均值为0,方差为Ds的高斯信号 %awgn channels 噪声和信号 Noise =0+ sqrt(Dn) * randn(1,N);%产生均值为0,方差为Dn=1的高斯噪声 singal=Single1+Noise; %Detection Process 检测过程 power=sum(singal.^2); Threshold=qfuncinv(Pf(i))*Dn*sqrt(2*N)+N*Dn;%给定的pf反推的Th if power>Threshold Over_Num_awgn(i)= Over_Num_awgn(i) +1; end end Pd(i)=Over_Num_awgn (i)/Sim_Times;endThreshold_matrix=qfuncinv(Pf)*Dn*sqrt(2*N)+N*Dn;Pd_theory=qfunc((Threshold_matrix-N*Dn-N*snr_avg*Dn)/(Dn*sqrt(2*N+4*N*snr_avg)));plot(Pf,Pd,'-*r')hold onplot(Pf,Pd_theory,'-*b')hold offxlabel('虚警概率Pf');ylabel('检测概率Pd');legend('仿真值','理论值');title('单用户能量检测ROC曲线图') 正在学习这个,谢谢分享! 判决门限是怎么确定的啊?
页:
[1]