%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Inputs:
%   -fileNameArray: is a cell array of file names of different .picotd files,
%     fileNameArray: start with { and put each file name in single quote, and
%     also between the file names should use semi colon. and end it with }
%   -folder: is the address of the folder for the .picotd files like:
%     'myfolder\', should be written as a function argument 
%   -Fs: Frequency sample, in our measurements, it is 1.2800e+13 
%   -fmin: lower band freqquency
%   -fmax: upper band frequency
%Output:
%   -mean_power: the avearage of powers in watt
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% if you don't want to calculate the power in a specific frequency band, then put Fs, fmin,
% and fmax equal to zero 

function mean_power = powAverages(fileNameArray, folder, Fs, fmin, fmax) 

%calculate the power for each .picotd file
for i = 1: length(fileNameArray)
    file_name= char(fileNameArray(i));
    ff = fullfile(folder, char(file_name));
   
    [p] = powerCal(ff, Fs, fmin, fmax);
end

% calculate the average of powers
mean_power = mean(p);

end



