function [out] = Spectra_Detto(in)


% spectra from Detto et al 2010 BLM

% Spectra_Detto.m

%
% 1-20-2012

% j=1,2,3,4, 5...u, T, H2O, CO2, CH4

% i = 1,2,3....stable, near neutral, unstable

% S(k) = S0(1 + k * km)^-v

% wave number, k=n/U

%k=in.n ./ in.u;

% Need to adjust for studies at different height that Sherman Island, which
% was at 3 m

k= in.z * in.n ./ (3* in.u);

% S0(i,j,n) power spectra
S0(1, :) = [4,2.5,3.1,1.6,0.4];  % stable
S0(2,:) = [8,5.3,3.8,2.9,0.2];   % near neutral
S0(3,:) =[8.9,6.8,5.2,3.9,2.3];  % unstable

% km(i,j,n) power spectra (m^-1)
km(1,:)= [4,3.1,4.3,3.1,2.1];    % stable
km(2,:)=[11.1,12.3,9.3,10.5,1.4]; % near neutral
km(3,:)=[14.2,16.8,12.2,14.8,15.2]; % unstable

% gamma(i,j,n), v, power spectra

v(1,:)=[1.7,1.5,1.6,1.3,1];
v(2,:)=[1.6,1.2,1.4,1.2,1];
v(3,:)=[1.6,1.3,1.4,1.2,1.3];

% S0(i,j,n) power spectra
Co.S0(1,:) = [4,2.5,3.1,1.6,0.4];
Co.S0(2,:) = [8,5.3,3.8,2.9,0.2];
Co.S0(3,:) =[8.9,6.8,5.2,3.9,2.3];

% km(i,j,n) power spectra
Co.km(1,:)= [4,3.1,4.3,3.1,2.1];
Co.km(2,:)=[11.1,12.3,9.3,10.5,1.4];
Co.km(3,:)=[14.2,16.8,12.2,14.8,15.2];

% gamma(i,j,n), v, power spectra

Co.v(1,:)=[1.7,1.5,1.6,1.3,1];
Co.v(2,:)=[1.6,1.2,1.4,1.2,1];
Co.v(3,:)=[1.6,1.3,1.4,1.2,1.3];


for ll=1:in.bins
for i=1:3
    for j=1:5
S(i,j,ll)=S0(i,j) *(1+ k(ll) * km(i,j)) ^-v(i,j);
    end
end
end



for ll=1:in.bins
for i=1:3
    for j=1:5
Co.S(i,j,ll)=Co.S0(i,j) * (1+ k(ll) * Co.km(i,j))^-Co.v(i,j);
    end
end
end

out.CoSp=Co.S;
out.Sxx=S;
end

