root/applications/bdmtoolbox/mex/mex_classes/mexGaussMergerArit.m @ 1207

Revision 1096, 1.2 kB (checked in by smidl, 14 years ago)

doc

Line 
1%> @brief Merger projecting sources to a Guassian using Arithmetic combination
2% ======================================================================
3classdef mexGaussMergerArit < mexMerger
4    methods
5        %> check consistency of the object and fill defaults
6        function obj=validate(obj)
7            if length(obj.sources)<1
8                error('No sources to merge');
9            end
10           
11            obj.merger= struct('class','egauss');
12        end
13               
14        %> Merge sources into the merger
15        function obj=merge(obj)
16            Cov = epdf_covariance(obj.sources{1});
17            mea = epdf_mean(obj.sources{1});
18           
19            Mom1 = obj.weights(1)*mea;
20            Mom2 = obj.weights(1)*(Cov+mea*mea');
21            for i=2:length(obj.sources)
22                Cov = epdf_covariance(obj.sources{i});
23                mea = epdf_mean(obj.sources{i});
24               
25                Mom1 = Mom1+ obj.weights(i)*mea;
26                Mom2 = Mom2 + obj.weights(i)*(Cov+mea*mea');
27            end
28            obj.merger.mu = Mom1;
29            obj.merger.R = Mom2 - Mom1*Mom1';
30            % transform old estimate into new estimate
31        end
32    end
33end
Note: See TracBrowser for help on using the browser.