function [yb,fb] = logSmoothSpec_Nbins(yy,ff,N)
%{
A function to smooth/average log frequency spectra (cospectra, powerspectra, etc.).
Data are binned and averaged on a log scale.  Outputs two arrays of frequency bin
centroids and binned spectral data.

Inputs: yy = spectral data
        ff = frequency data
        N = number of bins in output

Output: yb = binned spectral data
        fb = frequency at bin center
%}

yy = yy(2:end);
ff = ff(2:end);
logF = log10(ff);
lFmin = min(logF); lFmax = max(logF); lFrange = lFmax - lFmin;
ldF = lFrange/N;
logbinF = lFmin + (0:N)*ldF;
binF = 10.^logbinF;
binFc = 10.^(logbinF+ldF/2); binFc = binFc(:);   % bin centers on log scale

ys = interval_avg(ff, yy, binF);
fb = binFc(1:N);
yb = ys(:,2);

end
