% Name: bound_AWGN_conv_R13_K3_EbNo.m
% Date: November 21, 2007
% Description:
% Bounds for binary K=3 rate-1/3 convolutional codes with ML decoding with
% binary modulation over an AWGN channel.
%
% Copyright (c) 2007. Robert Morelos-Zaragoza. All rights reserved.

clear
rate=1/3;
df=8;
EbNo_init = 2; EbNo_inc = 0.5; EbNo_final = 8;
EbNov = []; Pb_VO = []; Pb_JZ = []; 

for EbNodB = EbNo_init:EbNo_inc:EbNo_final 
    EbNo = (10.^(EbNodB/10));
    x = exp(-rate*EbNo);
    % Omura-Viterbi bound
    Pb = (1-3*x^2+x^4)*(3*x^8-2*x^10) + (2*x^8-x^10)*(4*x^2-2*x^4) ...
         / ((1-3*x^2+x^4)^2);
    Pb_VO = [Pb_VO Pb];
    % Johannesson-Zigangirov bound
    Pb = Q(sqrt(2*df*rate*EbNo))*exp(df*rate*EbNo)*(1-3*x^2+x^4) ...
        *(3*x^8-2*x^10) + (2*x^8-x^10)*(4*x^2-2*x^4) / ((1-3*x^2+x^4)^2);
    Pb_JZ = [Pb_JZ Pb];
    EbNov = [EbNov EbNodB];
end

semilogy (EbNov,Pb_VO,'-ko');
hold on
semilogy (EbNov,Pb_JZ,'-ks');
axis([2 8 1e-7 0.1])
legend('VO bound','JZ bound')
xlabel('E_b/N_0 (dB)')
ylabel('BER')
grid on
