%hMultiCodewordPUSCHResults Display PUSCH conformance test results
%   hMultiCodewordPUSCHResults(SNRIN,NFRAMES,TRBLKSIZES,CRC,TPUT) plots the
%   conformance test results given a range of SNR points SNRIN, a number of
%   frames simulated for each point NFRAMES, the transport block sizes used
%   for each subframe TRBLKSIZES and the results CRC and TPUT.

%   Copyright 2009-2014 The MathWorks, Inc.

function hMultiCodewordPUSCHResults(SNRIn, NFrames, trBlkSizes, crc, tput)

    % First graph shows the throughput as total bits per second against the 
    % range of SNR
    figure;
    plot(SNRIn,mean(tput,2)*(size(tput,2)/(NFrames*10)),'-*')
    title(['Throughput for ', num2str(NFrames) ' frame(s)'] )
    xlabel('SNRdB'); ylabel('Throughput (kbps)');
    grid on;
    hold on;
    plot(SNRIn,mean(sum(trBlkSizes,1))*0.7*ones(1,numel(SNRIn)),'--rs');
    set(gca, 'YLim', [0 mean(sum(trBlkSizes,1))*1.05]);
    legend('Simulation Result','70 Percent Throughput','Location', ...
           'SouthEast')
    
    % Second graph shows the percentage throughput of successfully received 
    % frames (as total bits per second) against the range of SNRs
    figure;
    plot(SNRIn,100*(1-mean(crc,2)),'-*')
    title(['Throughput for ', num2str(NFrames) ' frame(s)'] )
    xlabel('SNRdB'); ylabel('Throughput (%)');
    grid on;
    hold on;
    plot(SNRIn,70*ones(1,numel(SNRIn)),'--rs');
    set(gca, 'YLim', [0 105]);
    legend('Simulation Result','70 Percent Throughput','Location',...
           'SouthEast')
    
end