N = 1000;
E = linspace(600,700,N);

E0 = 661.6;
sig = 30;
f = exp(-((E-661.6)/sig).^2);
plot(E,f,'-.','linewidth',2);

E_cutoff = 640;
decay = 10;
response = (E<E_cutoff) + (E>E_cutoff).*exp(-(E-E_cutoff)/decay);

hold on; plot(E,response,'r','linewidth',2);

f_net = f.*response;
plot(E,f_net,'linewidth',2);

legend(3,'Expected energy peak',...
       'Efficiency of the coincidence signal',...
       'Overall observed peak');
   
   ylim([-0.4 1.1]);
   fs = 14;
   xlabel('Energy (keV)','fontsize',fs);
   ylabel('Counts (arb. units)','fontsize',fs);
   title('Underestimation of incident energy by coincidence technique','fontsize',fs);