t_net = avg_fired_time;

% figure(1)
% plot(t_net,R)
[up,lo]= envelope(R,300,'peak');
% hold on
% plot(t_net,up,'-r',t_net,lo,'-r')
% hold off