Passing LPF' );grid on ; for i=1:min(length(bitstream1),length(bitstream2)) % 判决 if (bitstream1(i)>bitstream2(i)) bitstream(i)=1; else bitstream(i)=0; end end bitstream bit=[]; % 接收端波形 for i=1:length(bitstream) if bitstream(i)==0 bit1=zeros(1,N); else bit1=ones(1,N); end bit=[bit,bit1]; end figure(7) plot(bit),title( 'binary of receiving terminal' ),grid on ; axis([0,N*length(bitstream),-2.5,2.5]); endCheckRatePe 代码 function PeWrong=CheckRatePe(signal1,signal2,s) rights=0; wrongs=0; for ki=1:s-2 if (signal1(ki)==signal2(ki)) rights=rights+1; else wrongs=wrongs+1; end end PeWrong=wrongs/(wrongs+rights); end gussian 代码 function signal=gussian(transmittedSignal,noise) signal=sqrt(2)*transmittedSignal; signal=awgn(signal,noise); figure(4) plot(1:length(signal),signal),title( 'Adding Noise' );