ProductPURPOSEProduct of two Gaussians.
SYNOPSISfunction [g d]=Product(g1,g2)
DESCRIPTIONProduct of two Gaussians. Returns the Gaussian resulting from multiplying two other Gaussians. Note that the result of multiplying two Gaussians is a un-normalized Gaussian. Here we return the normalized Gaussian 'g' and the 'un-normalization' factor 'd'. CROSS-REFERENCE INFORMATIONThis function calls:
SOURCE CODE0001 function [g d]=Product(g1,g2) 0002 % Product of two Gaussians. 0003 % 0004 % Returns the Gaussian resulting from multiplying two other Gaussians. 0005 % Note that the result of multiplying two Gaussians is a un-normalized 0006 % Gaussian. Here we return the normalized Gaussian 'g' and the 0007 % 'un-normalization' factor 'd'. 0008 0009 if g1.dim~=g2.dim 0010 error('Gaussians with different dimensions in Gaussian product'); 0011 end 0012 0013 iS=g1.iS+g2.iS; 0014 0015 R=chol(iS); 0016 iR=R\eye(size(R)); 0017 S=iR*iR'; 0018 0019 % Matlab object fields must be defined always in the same order... 0020 g.m=S*(g1.iS*g1.m+g2.iS*g2.m); 0021 g.dim=g1.dim; 0022 g.S=S; 0023 g.d=1/(prod(diag(R))^2); 0024 g.iS=iS; 0025 g.ct=1/sqrt(((2*pi)^g.dim)*g.d); 0026 0027 g=class(g,'Gaussian'); 0028 0029 d=ProductNormFactor(g1,g2); |