function [MeanM, SigmaM] = Model2Lexic(MaxDeg,modeltype)
%Model2Lexic Values  of relative values lambda/Tstep.
%   [MeanM, SigmaM] = Model2Lexic(MaxDeg,modeltype) returns the column of values
%   for mean and sigma for QC, CP, CJ, JC, TK models as model types 
%   for lexicographical ordering of  Harmonic Functions 
%   with subscript < MaxDeg
%   
%   

%   author: Andrey Khokhlov. 
%   $Revision: 0.25 $  $Date: 2011/03/07 11:15:40 $
NSz=(MaxDeg+1)^2-1;
MeanM=zeros(NSz,1);
SigmaM=MeanM;
alpha=15.0;


switch upper(modeltype)
    case 'QC'
        alpha=27.7;
    case 'CP'
        alpha=27.7;
    case 'CJ'
        alpha=15.0;
    case 'JC'
        alpha=15.0;
    case 'TK'
          alpha=7.5;
          beta=3.8;
    otherwise
        error('MATLAB:Model2Lexic:InvalidInput', 'Input argument modeltype  must be either "QC, "CP", "CJ", "JC", "TK"')
end

ilex=1;
c2aParam=0.547;
RatPower=1;
for subsc=1: MaxDeg  
   RatPower=RatPower*c2aParam;   
   Value=alpha*RatPower/sqrt((subsc+1)*(2*subsc+1));
       
   for suprs=0:subsc

       SigmaM(ilex)=Value;
       ilex=ilex+1;
       if suprs == 0  
           continue;
       end
       SigmaM(ilex)=Value;
       ilex=ilex+1;           
   end
end
MeanM(1)=-30.0;

switch upper(modeltype)
    case 'CP'
        
        for ii=1:3
            SigmaM(ii)=3.0;
        end
        if MaxDeg > 1
            MeanM(4)=-1.8;
            for ii=4:8
                SigmaM(ii)=2.14;
            end  
        end
    case 'QC'
        
        for ii=1:3
            SigmaM(ii)=3.0;
        end
        if MaxDeg > 1
            MeanM(4)=-1.2;
            for ii=4:8
                SigmaM(ii)=1.3;
            end   
            for ii=5:6
                SigmaM(ii)=4.3;
            end 
        end

    case 'CJ'
        
        SigmaM(1)=11.72;
        for ii=2:3
            SigmaM(ii)=1.67;
        end
        if MaxDeg > 1
            MeanM(4)=-1.5;
            for ii=4:8
                SigmaM(ii)=1.16;
            end   
            for ii=5:6
                SigmaM(ii)=4.06;
            end  
        end
    case 'JC'
        
        SigmaM(1)=11.72;
        for ii=2:3
            SigmaM(ii)=1.67;
        end
        if MaxDeg > 1
            MeanM(4)=-1.5;
            for ii=4:8
                SigmaM(ii)=1.16;
            end   
            SigmaM(6)=8.12;
        end
    case 'TK'
        MeanM(1)=-18.0;
        
        for ii=1:3
            SigmaM(ii)=1.67;
        end
        if MaxDeg > 1
            for ii=4:8
                SigmaM(ii)=0.58;
            end  
        end
         ilex=1;
          isodd_sub=-1; mult_sub=-1;mult_sup=-1;
         for subsc=1: MaxDeg             
             isodd_sup=1;
             for suprs=0:subsc
                 if isodd_sub*isodd_sup < 0
                    SigmaM(ilex)=SigmaM(ilex)*beta;
                 end
                 ilex=ilex+1;
                 if suprs == 0 
                     isodd_sup=isodd_sup*mult_sup;
                     continue;
                 end
                 if isodd_sub*isodd_sup < 0
                    SigmaM(ilex)=SigmaM(ilex)*beta;
                 end
                 ilex=ilex+1;   
                 isodd_sup=isodd_sup*mult_sup;
             end
             isodd_sub=isodd_sub*mult_sub;
          end
        
end


return