✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信。
🍎个人主页:Matlab科研工作室
🍊个人信条:格物致知。
更多Matlab仿真内容点击👇
⛄ 内容介绍
该代码用于绘制简单能量检测的接收者操作特征曲线,当主信号为实高斯信号,噪声为 加性白实高斯。
⛄ 完整代码
%
clc
close all
clear all
L = 500;
snr_dB = -10; % SNR in decibels
snr = 10.^(snr_dB./10); % Linear Value of SNR
Pf = 0.01:0.01:1; % Pf = Probability of False Alarm
%% Simulation to plot Probability of Detection (Pd) vs. Probability of False Alarm (Pf)
for m = 1:length(Pf)
m
i = 0;
for kk=1:10000 % Number of Monte Carlo Simulations
n = randn(1,L); %AWGN noise with mean 0 and variance 1
s = sqrt(snr).*randn(1,L); % Real valued Gaussina Primary User Signal
y = s + n; % Received signal at SU
energy = abs(y).^2; % Energy of received signal over N samples
energy_fin =(1/L).*sum(energy); % Test Statistic for the energy detection
thresh(m) = (qfuncinv(Pf(m))./sqrt(L))+ 1; % Theoretical value of Threshold, refer, Sensing Throughput Tradeoff in Cognitive Radio, Y. C. Liang
if(energy_fin >= thresh(m)) % Check whether the received energy is greater than threshold, if so, increment Pd (Probability of detection) counter by 1
i = i+1;
end
end
Pd(m) = i/kk;
end
plot(Pf, Pd)
hold on
%% Theroretical ecpression of Probability of Detection; refer above reference.
thresh = (qfuncinv(Pf)./sqrt(L))+ 1;
Pd_the = qfunc(((thresh - (snr + 1)).*sqrt(L))./(sqrt(2).*(snr + 1)));
plot(Pf, Pd_the, 'r')
hold on
⛄ 运行结果
⛄ 参考文献
[1] 刘永姣. 认知无线电中基于能量检测的频谱感知技术研究[D]. 南开大学.
[2] 刘义贤, 季飞, 余华. 认知无线电网络中基于噪声功率估计的能量检测性能[J]. 电子与信息学报, 2011, 33(006):1487-1491.
[3] 张晓, 王金龙, 吴启晖. 认知无线电中一种基于循环谱的能量检测算法[J]. 电路与系统学报, 2010, 15(3):6.
[4] 胡富平. 基于能量检测的认知无线电协作频谱检测研究[D]. 华中科技大学.