clear all ; close all ; clc EbNo = 0:7; lens = 5:9; gens = [[35 23]; [51 73]; [171 133]; [371 247]; [753 561]]; for g = 1:length(gens) spect = distspec(poly2trellis(lens(g), gens(g,:)),lens(g)) ber_soft(:, g) = bercoding(EbNo,'conv','soft',1/2,spect); ber_hard(:, g) = bercoding(EbNo,'conv','hard',1/2,spect); end ber_u = berawgn(EbNo,'psk',4,'nondiff').'; ber1 = [ber_soft ber_u]; ber2 = [ber_hard ber_u]; figure(1) semilogy(EbNo, ber1,'LineWidth', 1.5) hold on legend('Soft (5,[35 23])',... 'Soft (6,[51 73])','Soft (7,[171 133])',... 'Soft (8,[371 247])','Soft (9,[753 561])',... 'Uncoded','location','best') grid on xlabel('Eb/No (dB)') ylabel('Bit Error Rate') figure(2) semilogy(EbNo, ber2,'LineWidth', 1.5) hold on legend('Hard (5,[35 23])',... 'Hard (6,[51 73])','Hard (7,[171 133])',... 'Hard (8,[371 247])','Hard (9,[753 561])',... 'Uncoded','location','best') grid on xlabel('Eb/No (dB)') ylabel('Bit Error Rate')