bpsk_ber1.m

来自「this is simulation program for baseband 」· M 代码 · 共 47 行

M
47
字号
clearN = 10^5 % number of bits or symbols% Transmitterip = rand(1,N)>0.5; % generating 0,1 with equal probabilitys = 2*ip-1; % BPSK modulation 0 -> -1; 1 -> 1 t=1000;b=(12/t)^0.5;for j=1:N        u=rand(1,t);        K=sum(u-0.5);        n(j)=b*K;% n:gnoise signalendEb_N0_dB = [-3:10]; % multiple Eb/N0 valuesfor ii = 1:length(Eb_N0_dB)   % Noise addition   y = s + 10^(-(Eb_N0_dB(ii)+3)/20)*n; % additive white gaussian noise      % receiver - hard decision decoding   y1=y>0;       % counting the errors   e=xor(y1,ip);   nErr(ii)=sum(e);endsimBer = nErr/N; % simulated bertheoryBer = 0.5*erfc(sqrt(10.^(Eb_N0_dB/10))); % theoretical ber% plotclose allfiguresemilogy(Eb_N0_dB,theoryBer,'b.-');hold onsemilogy(Eb_N0_dB,simBer,'mx-');axis([-3 10 10^-5 0.5])grid onlegend('theory', 'simulation');xlabel('Eb/No, dB');ylabel('Bit Error Rate');title('Bit error rate curve for BPSK modulation');

⌨️ 快捷键说明

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