It's in matlab. I am not used to matlab so sorry on the terrible quality. The main issue is that it fails to converge when the input data gets too big (data > 100 elements), especially when it's given > 2 clusters. The data must be given as a 2 by n matrix, where the two columns represent the x values and y values respectively.
Not even sure if is correct, but I think it should be.