P_D = [0:0.01:1]; 

SNR_dB = [0 3 6 9 12];
SNR = 10.^(SNR_dB/10.0);

P_FA = kron(SNR,P_D');

for i = 1:length(SNR)
    P_FA(:,i) = Q_func( norminv(1-P_D) + sqrt(SNR(i)));
end

figure
plot(P_FA, P_D, 'Linewidth', 1.5)
grid on
legend('SNR = 0 dB','SNR = 3 dB','SNR = 6 dB','SNR = 9 dB','SNR = 12 dB','Location','best');
title('Receiver Operating Characteristic (ROC) - RADAR Detetction Example')
xlabel('Probability of False Alarm')
ylabel('Probability of Detection')


EbNo_dB = 0:0.01:12;
EbNo = 10.^(EbNo_dB/10);
figure
semilogy(EbNo_dB, Q_func( sqrt( 2*EbNo ) ), 'Linewidth', 1.5);
grid on
title('Binary Phase Shift Keying Performance')
xlabel('E_b/N_0 (dB)')
ylabel('Probability of Bit Erro')