Matlab:绘制简单能量的接收机工作特性曲线(Energy_detection_simulation_ok)
生活随笔
收集整理的這篇文章主要介紹了
Matlab:绘制简单能量的接收机工作特性曲线(Energy_detection_simulation_ok)
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
Matlab:繪制簡單能量的接收機工作特性曲線(Energy_detection_simulation_ok)
?
?
目錄
輸出結果
實現(xiàn)代碼
?
?
?
?
?
輸出結果
?
實現(xiàn)代碼
% This code is to plot receiver operating characteristic curve for simple energy %繪制簡單能量的接收機工作特性曲線 % detection, when the primary signal is real Gaussian signal and noise is % addive white real Gaussian. Here, the threshold is available % analytically. % Code written by: Sanket Kalamkar, Indian Institute of Technology Kanpur, % India.%% 以下代碼繪制在虛警概率一定時,檢測概率和信噪比之間的關系曲線稱為檢測器的檢測性能曲線 clc close all clear all L = 1000; % The number of samples snr = 0.01:0.01:10; Pf = 10e-4; % Pf = Probability of False Alarm 虛警概率確定 %% Simulation to plot SNR vs.Probability of Detection (Pd) for m = 1:length(snr)i = 0;thresh = (qfuncinv(Pf)./sqrt(L))+ 1; % Theoretical value of Threshold, refer, Sensing-Throughput Tradeoff for Cognitive Radio Networks, Y. C. Liangfor kk = 1:5000 % Number of Monte Carlo Simulations(https://cn.mathworks.com/discovery/monte-carlo-simulation.html)n = randn(1,L); % AWGN noise with mean 0 and variance 1s = sqrt(snr(m)).*randn(1,L); % Real valued Gaussina Primary User Signaly = s + n; % Received signal at SU(認知用戶接收到的信號)energy = abs(y).^2; % Energy of received signal over N samplesenergy_fin =(1/L).*sum(energy); % Test Statistic for the energy detectionif(energy_fin >= thresh) % Check whether the received energy is greater than threshold, if so, increment Pd (Probability of detection) counter by 1i = i+1;endendPd(m) = i/kk; end plot(10*log(snr), Pd, 'r') xlabel('信噪比,單位db'); ylabel('檢測概率'); title('能量感知檢測性能曲線'); grid on hold on %% Theroretical expression 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))); % 原來代碼中的表達與論文中不一致 for k = 1:length(snr)Pd_the(k) = qfunc(((thresh - (snr(k) + 1)).*sqrt(L))./(sqrt(2).*snr(k) + 1)); % 與論文中的方程式保持一致 end plot(10*log(snr), Pd_the, 'b') legend('實際檢測概率', '理論檢測概率', 'Location', 'SouthEast'); hold on grid on?
?
總結
以上是生活随笔為你收集整理的Matlab:绘制简单能量的接收机工作特性曲线(Energy_detection_simulation_ok)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Matlab:单幅图象的暗原色先验去雾改
- 下一篇: Matlab:盲反卷积还原失焦图像