⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 smldpe55.m

📁 contemporarycommunicatonsystem-using MATLAB经典书目源程序!
💻 M
字号:
function [p]=smldPe55(snr_in_dB)% [p]=smldPe55(snr_in_dB)%		SMLDPE55  simulates the probability of error for the particular%   		value of snr_in_dB, signal to noise ratio in dB.E=1;SNR=exp(snr_in_dB*log(10)/10);	   	% signal to noise ratiosgma=E/sqrt(2*SNR);		   	% sigma, standard deviation of noiseN=10000;% generation of the binary data source followsfor i=1:N,   temp=rand;   	      		% a uniform random variable over (0,1)   if (temp<0.5),      dsource(i)=0;   	      		% with probability 1/2, source output is 0   else      dsource(i)=1;	      		% with probability 1/2, source output is 1   endend;% the detection, and probability of error calculation followsnumoferr=0;for i=1:N,   % The matched filter outputs   if (dsource(i)==0),      r=-E+gngauss(sgma);      		% if the source output is "0"   else      r=E+gngauss(sgma);     		% if the source output is "1"   end;   % detector follows   if (r<0),      decis=0;		      		% decision is "0"    else      decis=1;		      		% decision is "1"    end;   if (decis~=dsource(i)),    		% if it is an error, increase the error counter      numoferr=numoferr+1;   end;end;p=numoferr/N;	  	      		% probability of error estimate

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -