% Compute EBRdB for 419 to 765 Hz bandwidth at 3.95 Hz evoked rate
% Input:  StNFTA ... data structure holding N-FTA
% Output: EBRdB  ... scalar value
% Author G. Fischer
% -------------------------------------------------------------------------
function [EBRdB] = getEBRdB_HFO_01(StNFTA)
   fL = round(419/3.95);  % index lower corner frequency
   fH = round(765/3.95);  % index upper corner frequency
   bkgSum = 0;   % init background power sum with zero
   evoSum = 0;   % init evoked power sum with zero
   for n=fL:fH   % summation loop 
      if isnan(StNFTA.bkg(1,n)) == 0  % valid background power?
         bkgSum = bkgSum+StNFTA.bkg(1,n);
      end
      if isnan(StNFTA.evo(1,n)) == 0  % valid evoked powr?
         evoSum = evoSum+StNFTA.evo(1,n);
      end
   end
  EBRdB=10*log10(evoSum/bkgSum); % compute EBR and convert to dB
end

