认知无线电频谱感知之功率检测matlab代码
更新时间:2023-09-21 05:15:01 阅读量: 自然科学 文档下载
- 认知无线电频谱感知技术推荐度:
- 相关推荐
能量检测仿真实验代码:
clear all;clc; n = 5; ps = 1; SNR1 = -5; SNR2 = -8; SNR3 = -10;
% Sim_Times=10000; %Monter-Carlo times % m=5; T=0.001;
% 信号带宽W W=5*10^4; % 采样频率 Fs = 2*W; m = T*W; n = 2*T*W; % F0=W; % Fs=2;
% Sig=sqrt(2)*sin(2*pi*F0/Fs*t); %single tone samples, Fs=2F0 % 实际信噪比
snr1 = 10.^(SNR1/10); snr2 = 10.^(SNR2/10); snr3 = 10.^(SNR3/10); pn = (1/snr1)*ps; mu0 = n*pn;
sigma0 = sqrt(2*n)*pn; mu = n*(pn+ps);
sigma = sqrt(2*n*(pn^2+2*pn*ps));
% [noi,x0,mu0,sigma0,m0] = cnoi( n,pn ); % sig = randn(n,1); sig = 1; % 重复次数 count = 5000;
% 能量检测判决门限 lambda = [200:20:600]; lambda1 = [500:20:900]; lambda2 = [700:30:1300]; % 置信度判决参数 % tt = [-5:0.4:3]; % cc = 10.^tt;
% tt1 = [-1:0.1:1]; % cc1 = 10.^tt;
% cc2 = [-0.01:0.001:0.01];
for kk = 1:1:length(lambda); ff = 0; dd = 0; ff1 = 0; dd1 = 0; ff2 = 0; dd2 = 0;
for ii=1:1:count; t = (kk-1)*n+1:kk*n; init_phase = 1/6*pi;
sig=2*sin(2*pi*W/Fs*t+init_phase); %sig=1;
%dot(sig,sig)/n noi1 = randn(1,n);
noi1 = sqrt(1/snr1)*noi1; rec1 = noi1 + sig; noi2 = randn(1,n);
noi2 = sqrt(1/snr2)*noi2; rec2 = noi2 + sig; noi3 = randn(1,n);
noi3 = sqrt(1/snr3)*noi3; rec3 = noi3 + sig;
sum0_1 = dot(noi1,noi1); sum0_2 = dot(noi2,noi2); sum0_3 = dot(noi3,noi3); sum1_1 = dot(rec1,rec1); sum1_2 = dot(rec2,rec2); sum1_3 = dot(rec3,rec3); %单用户能量检测判决
if (sum0_1 > lambda(kk)); ff = ff+1; end
if (sum1_1 > lambda(kk)); dd = dd+1; end
if (sum0_2 > lambda1(kk)); ff1 = ff1+1; end
if (sum1_2 > lambda1(kk)); dd1 = dd1+1; end
if (sum0_3 > lambda2(kk)); ff2 = ff2+1; end
if (sum1_3 > lambda2(kk)); dd2 = dd2+1; end end
Pd_1(kk) = dd/count; Pf_1(kk) = ff/count; Pd_2(kk) = dd1/count; Pf_2(kk) = ff1/count; Pd_3(kk) = dd2/count; Pf_3(kk) = ff2/count; end
plot(Pf_1,Pd_1,'-o',Pf_2,Pd_2,'-s',Pf_3,Pd_3,'-*'); hold on; grid on;
xlabel('False alarm probability, P_{Fa}'); ylabel('Detection probability, P_{d}');
legend('能量检测 SNR=-5dB,n=100','能量检测 SNR=-8dB,n=100','能量检测 SNR=-10dB,n=100'); grid on; hold on;
正在阅读:
欢送会节目策划案05-12
幼儿园师德师风培训发言稿01-06
答案作文600字06-24
道德与人性11-03
H资本运作04-30
GB28050预包装食品营养标签通则(2014年4月) - 图文04-06
高压电气试验收费标准08-07
电机厂的实习报告通用10篇03-23
- 安徽大学2015 - C语言试卷
- 全面质量管理
- 慢一点,让数学课堂教学更精彩
- 作文讲评(桥面与桥墩)
- 推荐K12学习2018八年级语文下册第六单元23马说教案新人教版1
- 电子商务实训计划
- 希姆莱的宠臣:瓦尔特 舒伦堡 - 图文
- 2013城市设计课程作业获奖名单
- 苏教版必修二基础知识练习
- 信号完整性和电磁兼容习题
- 广元十三五农业和农村经济发展规划 - 图文
- state命令
- 最新人音版小学音乐三年级下册《空山鸟语》公开课教学设计
- 2019年PEP人教版小学英语五年级下册4 Unit 4单元检测题
- 浅谈对新闻深度报道的认识
- 广州中兴VoLTE优化案例
- 信息工程系世界大学城学生个人空间建设大赛活动方案
- 2012年全国中学生生物奥赛试题和答案
- 百家争鸣教学反思
- 高中数学平面几何拓展-数学竞赛知识