% Decoy state protocol simulation
% Author: Michel Barbeau
% Version: March 7, 2017
% generate k-photon random pulses
n=1000000;
% quantum efficiency
eta=0.1;
% vacuum pulse detection
y0=0.01;
normal=[]; % efficiency under normal operation 
attack=[]; % efficiency under attack 
% simulate decoy state protocol under normal and attack conditions
for lambda=0.1:0.1:1 % parameter of Poisson distribution
    [ e1, e2 ] = decoyprotocol(lambda,  eta, y0, n);
    normal=[normal e1]; 
    attack=[attack e2]; 
end
stem(0.1:0.1:1,attack);
xlabel('\lambda');
ylabel('\eta');
grid on;
hold on;
plot(0.1:0.1:1,normal,'--');
legend('attack effeciencey', 'normal efficiencey');
