gusucode.com > UWB_matlab源码程序 > CP0602/cp0602_symbol_error_probability.m
% % FUNCTION 6.1 : "cp0602_symbol_error_probability" % % Analysis of the symbol error probability for M-PAM and % M-PPM signals % % The function computes and plots the symbol error % probability for M-PAM and M-PPM signals % for M = {2, 4, 8} as a function of Eb/N0 % % Programmed by Luca De Nardis function cp0602_symbol_error_probability % -------------------------- % Step Zero - Initialization % -------------------------- Eb_N0 = logspace(0.5,2); % Range of Eb/N0: 5-20 dB M = [2 4 8]; % Values of M % ------------------------------------------------- % Step One - Evaluation of symbol error probability % ------------------------------------------------- for i=1:3 M_PAM(i,:)=(1-1/M(i))*erfc(sqrt(Eb_N0 * 3 *... log2(M(i))/(M(i)^2-1))); M_PPM(i,:)= exp(-0.5 * log2(M(i))*(Eb_N0 - 2 *... log(2))); end % --------------------------- % Step Two - Graphical output % --------------------------- M_ary_BEP = [M_PAM' M_PPM']' % Building a single matrix % for all vectors F=figure(1); set(F,'Position',[100 190 650 450]); set(gcf,'DefaultAxesColorOrder',[0 0 0],... 'DefaultAxesLineStyleOrder','-+|-o|-*|:s|:d|:^'); PT=semilogy(10*log10(Eb_N0),M_ary_BEP); set(PT,'LineWidth',[2]); hold on L= legend('2-PAM','4-PAM','8-PAM','2-PPM','4-PPM','8-PPM'); set(L,'FontSize',12); set(PT,'LineWidth',[2]); X=xlabel('E_b/N_0'); set(X,'FontSize',14); Y=ylabel('Pr_e'); set(Y,'FontSize',14); AX=gca; set(AX,'FontSize',12); axis([5 20 1e-6 1e-1]); set(AX,'XTick', [5 7.5 10 12.5 15 17.5 20 ]); grid on