function [alpha] = crest_wave_profile_mbari_multi1_pared(processedScan)
%
g = 9.806; rho = 1.025e3;
%
% Mc is the number of crests considered in each scan.
% Mt is the number of scans.
% processedScan is Mc x Mt
%
Nf = 128*2*2;   %Number of points in the frequency spectrum
Mf = Nf;
oml = 0.18;     %Low and high cut-off frequencies, radian/sec. 
omh = 1.57;
%Mc = 3;         %Number of crests
%Mt = 8;         %Number of scans  
delt = 1.26;    %time between scans + 1/2 the time needed for 1 scan.
dims = size(processedScan);
Mc = dims(1);
Mt = dims(2);
%
%
omeg = zeros(Nf,1);
delom = (omh-oml)/double(Nf);
omeg = zeros(Mf,1);
%
for m = 1:Mf
    omeg(m,1) = oml + double(m-1)*delom;
end

for m = 1:Mf
    k(m,1) = omeg(m,1)^2/g;
end

tm = zeros(Mt,1);
%
for mt = 1:Mt
    tm(mt,1) = double(mt-1)*delt;
end %mt
%
fname1 = processedScan;

xc = zeros(Mc,Mt,1);
yc = zeros(Mc,Mt,1);
%
for m = 1:Mc
    for mt = 1:Mt
    xc(m,mt,1) = -fname1(m,mt);
    yc(m,mt,1) = 0.5;
    end % mt
end %m
%
Ac = zeros(Mf,1);
Bc = zeros(Mf,1); % set to unity
alpha = zeros(Mf,1); % phases
C = zeros(Mf,1); % amplitudes
%

for n = 1:Mf
    sumnum = 0.0;
    sumden = 0.0;
    for m = 1:Mc
        sumnt = 0.0;
        for mt = 1:Mt
          cterm = cos(k(n,1)*xc(m,mt,1) - omeg(n,1)*tm(mt,1));
          sumnt = sumnt + cterm;
        end %mt
        sumnum = sumnum + sumnt/double(Mt);
    end %m
    %
    for m = 1:Mc
        sumdt = 0.0;
        for mt = 1:Mt
          sterm = sin(k(n,1)*xc(m,mt,1) - omeg(n,1)*tm(mt,1));
          sumdt = sumdt + sterm;
        end %mt
        sumden = sumden + sumdt/double(Mt);
    end
    %
    Ac(n,1) = sumnum/sumden;
    alpha(n,1) = atan2(1.0,Ac(n,1));
end %n




