M=8;EbNodB = 0:2:20;EbNolin = 10.(EbNodB/10);Pe_sim=;for i = 1:11Pe_sim=Pe_sim QAM_rayleigh(M, EbNodB(i);end% 画瑞利衰落信道下 误码 率曲线semilogy(EbNodB,Pe_sim,r*)hold on% 计算理论误码 率if(M=4)a=1;elsea=4/log2(M);endb=3*log2(M)/(M-1);Pe=;for i = 1:11Pe= Pe 0.5*a*(1-sqrt(0.5*b*EbNolin(i)/(1+0.5*b*EbNolin(i);end % 计算方式出处: Wireless Communication, A.Goldsmith%绘制理论误码 率曲线semilogy(EbNodB,Pe)xlabel(snr, EbNo(dB);ylabel(Bit error probability, Pe);legend(8QAM仿真结果,8QAM 理论结果 );hold on;0 2 4 6 8 10 12 14 16 18 20snr, EbNo(dB)10-310-210-1100Bit errorprobability,Pe8QAM仿真结果8QAM理论结果