Home > atmlab > h2o > parametrisations > gamma_lambda2d.m

gamma_lambda2d

PURPOSE ^

converts lambda to Dme or Dmean or reverse

SYNOPSIS ^

function [y]=gamma_lambda2d(f,mu,beta,lambda,Dme,Dmean)

DESCRIPTION ^

converts lambda to Dme or Dmean or reverse

        This function converts lambda or Dme or Dmean
        to Dme or Dmean or lambda, for a gamma distribution
        of the form n(D)=N*D^mu*exp(-lambda*D).
        Dme is the median mass diameter,Dmean is the mean
        mass diameter. 
 
 OUT     vector of Dme[m] or Dmean[m] or lambda[m^-1] depending on input

 IN      f       what to convert
                 1 = lambda to Dme
                 2 = lambda to Dmean
                 3 = Dme    to lambda
                 4 = Dmean  to lambda
         mu      the width of gamma distribution mu>-2 
         beta    exponent in particle mass-diameter relationship
                 m(D)=alfa*D^beta,beta=3 for spheres or ellipsoids         
         lambda  size parameter of gamma distribution [m^-1]
                 empty if f=3 or 4
         Dme     mass median diameter [m]
                 empty if f=1 or 2
         Dmean   mass mean diameter [m]
                 empty if f=1 or 2

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

gamma_lambda2d.m

SOURCE CODE ^

0001 %converts lambda to Dme or Dmean or reverse
0002 %
0003 %        This function converts lambda or Dme or Dmean
0004 %        to Dme or Dmean or lambda, for a gamma distribution
0005 %        of the form n(D)=N*D^mu*exp(-lambda*D).
0006 %        Dme is the median mass diameter,Dmean is the mean
0007 %        mass diameter.
0008 %
0009 % OUT     vector of Dme[m] or Dmean[m] or lambda[m^-1] depending on input
0010 %
0011 % IN      f       what to convert
0012 %                 1 = lambda to Dme
0013 %                 2 = lambda to Dmean
0014 %                 3 = Dme    to lambda
0015 %                 4 = Dmean  to lambda
0016 %         mu      the width of gamma distribution mu>-2
0017 %         beta    exponent in particle mass-diameter relationship
0018 %                 m(D)=alfa*D^beta,beta=3 for spheres or ellipsoids
0019 %         lambda  size parameter of gamma distribution [m^-1]
0020 %                 empty if f=3 or 4
0021 %         Dme     mass median diameter [m]
0022 %                 empty if f=1 or 2
0023 %         Dmean   mass mean diameter [m]
0024 %                 empty if f=1 or 2
0025 function [y]=gamma_lambda2d(f,mu,beta,lambda,Dme,Dmean)
0026  
0027 min_nargin( 6, nargin );
0028 
0029 if f==1
0030   y=(beta+mu+0.67)./lambda;
0031 elseif f==2
0032   y=gamma(beta+2+mu)./gamma(beta+1+mu)./lambda;
0033 elseif f==3
0034   y=(beta+mu+0.67)./Dme;
0035 elseif f==4
0036   y=gamma(beta+2+mu)./gamma(beta+1+mu)./Dmean;
0037 else
0038  error('f must be equal to 1,2,3, or 4')
0039 end
0040 y=vec2col(y);

Generated on Mon 15-Sep-2014 13:31:28 by m2html © 2005