gaussian_mixture_model.m
A Gaussian mixture model means that each data point is drawn (randomly) from one of C classes of data, with probability p_i of being drawn from class i, and each class is distributed as a Gaussian with mean standard deviation mu_i and sigma_i. Given a set of data drawn from such a distribution, we seek to estimate these unknown parameters.
The algorithm used here for estimation is EM (Expectation Maximization). Simply put, if we knew the class of each of the N input data points, we could separate them, and use Maximum Likelihood to estimate the parameters of each class. This is the M step. The E step makes (soft) choises of (unknown) classes for each of the data points based on the previous round of parameter estimates for each class.
Implicitly the data is classfied (or clustered) into the different classes, whose parameters are estimated.
The current code only works for 1D data, and is primarily of use in illustrating the idea about mixture models and EM, but it would be pretty easy to generalize to higher dimensions.
Cite As
Matthew Roughan (2026). gaussian_mixture_model.m (https://www.mathworks.com/matlabcentral/fileexchange/24867-gaussian_mixture_model-m), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
Tags
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
