Home > atmlab > math > gauss_laguerre_apply.m

gauss_laguerre_apply

PURPOSE ^

gauss_laguerre_apply performs Laguerre Gauss quadrature

SYNOPSIS ^

function Y = gauss_laguerre_apply(Y,x_i,w_i,varargin)

DESCRIPTION ^

 gauss_laguerre_apply performs Laguerre Gauss quadrature
    
     Returns a vector or matrix depending on input with for example 
     particle number density after performing
     Laguerre Gauss quadrature to represent scattering properties
     of particle polydispersions. 
     For information on Gaussian quadrature see for example
     numerical recipies


     An example on usage (to generate a PSD for ice particles):
        xnorm = 50e-6;
        [x_i,w_i] = gauss_laguerre(0,10,xnorm);
        y = ice_psd_gamma( ... );
        y = gauss_laguerre_apply(y,x_i,w_i,xnorm);

 FORMAT   [Y] = gauss_laguerre_apply(Y,x_i,w_i,xnorm])     

 OUT      Y      A matrix or vector with the integrated
                 values of Y

 IN       x_i    is a vector with abscissas
          w_i    is a vector with weights
          xnorm  Normalisation value for length scale.
          Y      The function to be integrated evaluated
                 at x_i

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

gauss_laguerre_apply.m

SOURCE CODE ^

0001 % gauss_laguerre_apply performs Laguerre Gauss quadrature
0002 %
0003 %     Returns a vector or matrix depending on input with for example
0004 %     particle number density after performing
0005 %     Laguerre Gauss quadrature to represent scattering properties
0006 %     of particle polydispersions.
0007 %     For information on Gaussian quadrature see for example
0008 %     numerical recipies
0009 %
0010 %
0011 %     An example on usage (to generate a PSD for ice particles):
0012 %        xnorm = 50e-6;
0013 %        [x_i,w_i] = gauss_laguerre(0,10,xnorm);
0014 %        y = ice_psd_gamma( ... );
0015 %        y = gauss_laguerre_apply(y,x_i,w_i,xnorm);
0016 %
0017 % FORMAT   [Y] = gauss_laguerre_apply(Y,x_i,w_i,xnorm])
0018 %
0019 % OUT      Y      A matrix or vector with the integrated
0020 %                 values of Y
0021 %
0022 % IN       x_i    is a vector with abscissas
0023 %          w_i    is a vector with weights
0024 %          xnorm  Normalisation value for length scale.
0025 %          Y      The function to be integrated evaluated
0026 %                 at x_i
0027 
0028 % History: 2005-06-28  Created by Bengt Rydberg
0029 
0030 function Y = gauss_laguerre_apply(Y,x_i,w_i,varargin)
0031 %
0032 [xnorm] = optargs( varargin, { 1 } );
0033 
0034 
0035 %= Check input
0036 %
0037 if length(x_i) ~= length(w_i)
0038   error('Length of *x_i* and *w_i* must be identical.');
0039 end
0040 %
0041 if size(Y,1) ~= length(x_i)
0042   error('Size of *Y* does not match length of *x_i*');
0043 end
0044 
0045 
0046 x_i = x_i / xnorm;
0047 
0048 x_i = vec2col( x_i );
0049 w_i = vec2col( w_i );
0050 
0051 Y = Y .* repmat(xnorm*exp(x_i).*w_i,1,size(Y,2));

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