Home > atmlab > retrieval > mci_max.m

mci_max

PURPOSE ^

MCI_MAX Max probability retrieval by Monte Carlo integration (MCI)

SYNOPSIS ^

function [imax,wmax] = mci_max(Yb,Se,Y)

DESCRIPTION ^

 MCI_MAX   Max probability retrieval by Monte Carlo integration (MCI)

   This is a version of MCI retrieval. Standard retrievals are handled by
   *mci*. In this version, the retrieval is simply the database case having
   the highest a posterior probability. Or the highest weight in the
   nomenclature of *mci*.

   To keep thing simple, only index of the max probable case and its "weight"
   are returned. Again in the nomneclature if *mci*, the actual solution is
   Xb(:,imax).

 FORMAT   [imax,wmax] = mci_max(Yb,Se,Y)
        
 OUT   imax   Index of Yb-columns giving best match with each *Y*
       wmax   The weight corresponding to *imax*.
 IN    Yb     Measurements of the retrieval database
       Se     Observation unvertainty covariance matrix.
       Y      Measurements to be inverted.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

mci_max.m

SOURCE CODE ^

0001 % MCI_MAX   Max probability retrieval by Monte Carlo integration (MCI)
0002 %
0003 %   This is a version of MCI retrieval. Standard retrievals are handled by
0004 %   *mci*. In this version, the retrieval is simply the database case having
0005 %   the highest a posterior probability. Or the highest weight in the
0006 %   nomenclature of *mci*.
0007 %
0008 %   To keep thing simple, only index of the max probable case and its "weight"
0009 %   are returned. Again in the nomneclature if *mci*, the actual solution is
0010 %   Xb(:,imax).
0011 %
0012 % FORMAT   [imax,wmax] = mci_max(Yb,Se,Y)
0013 %
0014 % OUT   imax   Index of Yb-columns giving best match with each *Y*
0015 %       wmax   The weight corresponding to *imax*.
0016 % IN    Yb     Measurements of the retrieval database
0017 %       Se     Observation unvertainty covariance matrix.
0018 %       Y      Measurements to be inverted.
0019 
0020 % 2014-09-04   Created by Patrick Eriksson, based on the existing mci.m
0021 
0022 function [imax,wmax] = mci_max(Yb,Se,Y)
0023 
0024 % Some sizes
0025 nb = size(Yb,2);
0026 m  = size(Y,1);
0027 ny = size(Y,2);
0028 
0029 % Check that dimensions of Yb and Y are consistent:
0030 if size(Y,1) ~= m
0031     error('Dimensions of Yb and Y do not match')
0032 end
0033 
0034 % Check that dimensions of Y and Se are consistent:
0035 if size(Se,1) ~= m  |  size(Se,2) ~= m
0036     error('Dimensions of Se and Y do not match')
0037 end
0038 
0039 % Init output arguments
0040 %
0041 [imax,wmax] = deal( zeros( ny, 1 ) );
0042 
0043 
0044 for i = 1 : ny
0045 
0046   w = exp( -0.5*chi2( repmat(Y(:,i),1,nb)-Yb, Se ) );
0047 
0048   % Find max weight, and if happen to be duplicates take first value
0049   [wm,im] = max( w );
0050   wmax(i) = wm(1);
0051   imax(i) = im(1);
0052   
0053 end
0054

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