x = randint (1,900000); z = 2 * x - 1; n = randn(1, 900000); for a=0:.1:10, i = a /10; s = sqrt(2*(10^i)).*z; y = s + n; t = sign (y); %w = x ~= t; %num = sum (w); [x, ratio]=symerr (z, t); %num / 900000; be(round(10*a+1))= ratio; end figure; q=0:0.1:10; i = 10 .^ (q / 10); BER_theo = 0.5*erfc(sqrt(i)); semilogy (q, be,'--rs', q, BER_theo, 'c+:'); grid on,