function [P, F] = compSpectrum(sig, winlen, ...
    wintype, fftlen, overlap, Fs)
%
% function for matweb, computes the spectrum and returns the
% components in a format that we use in the ispect files.

%global parameters
global siglen fixedfftlen;

%Window type
switch wintype
  case 'bartlett'
    w = bartlett(winlen);
  case 'blackman'
    w = blackman(winlen);
  case 'hamming'
    w = hamming(winlen);
  case 'hanning'
    w = hanning(winlen);
  case 'boxcar'
    w = boxcar(winlen);
end

% assign spectrum overlap values, in case it wasn't originally
% specified.  This is mainly in the case where welch's was chosen
% for the current plot, but not for the saved case
if (isnan(overlap) | (overlap>fftlen) | (overlap<0))
  overlap = round(winlen/2);
end
[P, F] = spectrum(sig, fftlen, overlap, w, Fs);
P = P(:,1);




