资源简介

里面有cm_bpske.m gngauss.m trng_guass.m三个文件

资源截图

代码片段和文件信息

function[p]=cm_bpske(snr_in_db)
% [p]=cm_bpske(snr_in_db)
% cm_bpske finds the probability of error for the given value of snr_in_db

N=5000;
E=1;                            %energy per symbol
snr=10^(snr_in_db/10);         %signal to noise ratio
sgma=E/sqrt(snr*2);           %noise variance

%generation of data source
for i=1:N
    temp=rand;
    if(temp<0.5)
        dsource(i)=0;
    else
        dsource(i)=1;
    end
end


%detection and the probability of errror calculation
numofbiterror=0;
for i=1:N
    %received signal at the detector for the ith symbol is:
       if (dsource(i)==0)
        r0=E+gngauss(sgma);
        r1=gngauss(sgma);
    else
        r1=E+gngauss(sgma);
        r0=gngauss(sgma);
    end
    
    
    % the detector is:
    if(r0>r1)
        decis=0;
    else
        decis=1;
    end
        
    %increment the error counterif the decision is not correct
    if (decis~=dsource(i))
        numofbiterror=numofbiterror+1;
    end
    
end
p=numofbiterror/N;

    

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       1048  2003-08-10 12:05  AWGN\cm_bpske.m

     文件        711  2003-08-10 14:12  AWGN\gngauss.m

     文件        735  2003-08-10 12:02  AWGN\trng_guass.m

    ..AD...         0  2003-08-11 12:19  AWGN

----------- ---------  ---------- -----  ----

                 2494                    4


评论

共有 条评论