Home > atmlab > math > fwhm.m

fwhm

PURPOSE ^

==============================================================================

SYNOPSIS ^

function res = fwhm(z,A)

DESCRIPTION ^

==============================================================================
 function res = fwhm(z,A)

 Calculates the full width at half mean of the averaging kernels.

 In:    z    vector of heights [m]
    A    matrix of averaging kernels

 Out:    res    FWHM vertical resolution [m]
==============================================================================

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

fwhm.m

SOURCE CODE ^

0001 %==============================================================================
0002 % function res = fwhm(z,A)
0003 %
0004 % Calculates the full width at half mean of the averaging kernels.
0005 %
0006 % In:    z    vector of heights [m]
0007 %    A    matrix of averaging kernels
0008 %
0009 % Out:    res    FWHM vertical resolution [m]
0010 %==============================================================================
0011 
0012 % Patrick Eriksson 1995
0013 
0014 
0015 function res = fwhm(z,A)
0016 
0017 
0018 [m,n] = size(A);
0019 res = zeros(m,1);
0020 
0021 
0022 for i = 1:m
0023   [mv,i0] = max(A(i,:));
0024 
0025   if mv == 0
0026     res(i) = NaN;
0027   else
0028 
0029   i2 = i0-1;
0030   if (i2 == 0), i2 = 1; end
0031   while A(i,i2)>(mv/2) 
0032     i2 = i2-1;
0033     if (i2 < 1),break; end
0034   end
0035   if (i2 >= 1)
0036     p1 = interp1(A(i,[i2:i2+1]),z([i2:i2+1]),mv/2);
0037   else
0038     p1 = z(1);
0039   end
0040   i2 = i0+1;
0041   if (i2 > n), i2 = n; end
0042   while A(i,i2)>(mv/2)
0043     i2 = i2+1;
0044     if (i2 > n), break; end
0045   end
0046   if (i2 <= n)
0047     p2 = interp1(A(i,[i2-1:i2]),z([i2-1:i2]),mv/2);
0048   else
0049     p2 = z(n);
0050   end
0051   res(i) = p2-p1;
0052 
0053   end
0054 end

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