0

How can I calculate the mean and median of a Gaussian Mixture Model with three components like the following parameters in MATLAB:

Priors[0.4,0.25,0.34]

Centers [0.44;0.74;0.05]

Co-variance [0.03,0.18,0.03]

Thanks

1 Answers1

1

Here is the MATLAB code for calculating mean and median of a Gaussian Mixture Model (GMM):

Mean Calculation for N GMMs:

for i = 1:N
   mu = center{i};
   p = prior{i};
   mean_mix(i) = mu(1)*p(1) + mu(2)*p(2) + mu(3)*p(3);
end

Median Calculation for N GMMs:

median = zeros(N,1);
for i = 1:N
    for j = 2:N
         if (fix(trapz(x(1:j), gmm_pdfs(1:j,i))*100) == 50); 
             median(i) = x(j);
         end
    end
end

Note: gmm_pdfs are the evaluated pdfs against x.