K-means algorithm demo
Version 1.0.2.0 (1.59 KB) by
Mauricio Martinez-Garcia
A simple implementation of the kmeans algorithm
The k-means algorithm is widely used in a number applications like speech processing and image compression.
This script implements the algorithm in a simple but general way. It performs four basic steps.
1. Define k arbitrary prototypes from the data samples.
2. Assign each sample to the nearest prototype.
3. Recalculate prototypes as arithmetic means.
4. If a prototype changes, repeat step (2).
Cite As
Mauricio Martinez-Garcia (2026). K-means algorithm demo (https://www.mathworks.com/matlabcentral/fileexchange/16762-k-means-algorithm-demo), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Created with
R2006b
Compatible with any release
Platform Compatibility
Windows macOS LinuxCategories
Find more on Statistics and Machine Learning Toolbox in Help Center and MATLAB Answers
Tags
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
