概述
%%%%%%%%%%%%%%%%%%%%%%%%%检测时间可变%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear all
clc;
close all;
fs = 12000; %抽样频率
Ts = 0.001 : 0.001 : 0.1; %检测时间
Sampling_Num1 = fs * Ts; %抽样数量
Sampling_Num = round(Sampling_Num1);
Simulation_Num = 800; %仿真次数
SNR_dB = -5; %信噪比(分贝) %SNR_dB_Vector = ( -20 : 4 : 10 );
Noise_Power = 1; % 噪声功率
for i1 = 1 : length( Ts )
Decision_Index = zeros( 1, Simulation_Num );
SNR = 10^( SNR_dB/10 );
PUser_Signal_Power = SNR * Noise_Power;
Noise = sqrt( Noise_Power ) * randn( 1, Sampling_Num(i1) ); %噪声
PUser_Signal = sqrt( PUser_Signal_Power ) * randn( 1, Sampling_Num(i1) ); %授权用户信号
for i2 = 1:Simulation_Num
Noise = sqrt( Noise_Power ) * randn( 1, Sampling_Num(i1) ); %噪声
PUser_Signal = sqrt( PUser_Signal_Power ) * randn( 1, Sampling_Num(i1) ); %授权用户信号
if i2 <= Simulation_Num/2
Received_Signal = PUser_Signal + Noise; %%%% 用于计算检测概率
else
Received_Signal = Noise; %%%% 用于计算虚警概率
end;
Pd = 0.8;
Energy_Channel( i2 ) = sum( abs( Received_Signal ) .^ 2 ); %求能量
Energy_Threshold ( i2 ) = norminv ( 1 - Pd, ( Sampling_Num(i1) + SNR ), sqrt( 2 * ( Sampling_Num(i1) + 2 * SNR) ) ); %高斯分布函数求阈值
if ( Energy_Channel( i2 ) > Energy_Threshold( i2 ) );
Decision_Index( i2 ) = 1;
end;
end;
%%%%%%%%%%%%%%% 计算正确检测概率与虚警概率 %%%%%%%%%%%
Decision_Index_1 = Decision_Index( 1 : Simulation_Num/2 );
Decision_Index_2 = Decision_Index( ( Simulation_Num/2 + 1 ) : Simulation_Num );
ED_Num_CorDet = sum( Decision_Index_1 ); %检测个数
ED_Num_FalseDet = sum( Decision_Index_2 ); %虚警个数
ED_Prob_CorDet( i1 ) = ED_Num_CorDet / ( Simulation_Num/2 ); %检测概率
ED_Prob_MisDet( i1 ) = 1 - ED_Prob_CorDet( i1 ) ; %漏检概率
ED_Prob_FalseDet( i1 ) = ED_Num_FalseDet / ( Simulation_Num/2 ); %虚警概率
end;
hold on
grid on
plot ( Ts, ED_Prob_CorDet, 'b' );hold on
plot ( Ts, ED_Prob_MisDet, '*' );hold on
plot ( Ts, ED_Prob_FalseDet, 'r' );hold on
title('检测时间改变时检测概率漏检虚警概率曲线')
xlabel('Ts = 0.00 : 0.001 : 0.01')
h=legend('检测','漏检','虚警',3);
最后
以上就是清秀冬日为你收集整理的信号检测检测时间改变时检测概率_漏检_虚警概率曲线的全部内容,希望文章能够帮你解决信号检测检测时间改变时检测概率_漏检_虚警概率曲线所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复