How to avoid uncertainty in processing result of MATLAB Statistics Toolbox
Show older comments
I’m annoyed with the uncertainty of the processing result of my MATLAB program. My codes are as follows.
%-----------------------------
clear all; close all;
a = [0.3948 0.4644 0.4412 0.6270 0.6270 0.1626];
[idx c] = kmeans(a,2)
rate = c(1)/c(2)
%-----------------------------
I ran this program several times and found the results were quite interesting. Although the data set to be processed was determinate, the processing results could be different each time. I found there were at least four groups of answers.
%-----------------------------
idx = 1 1 1 2 2 1 c = 0.3658 0.6270 rate = 0.5833
idx = 1 1 1 1 1 2 c = 0.5109 0.1626 rate = 3.1419
idx = 2 2 2 1 1 2 c = 0.6270 0.3658 rate = 1.7143
idx = 2 2 2 2 2 1 c = 0.1626 0.5109 rate = 0.3183
%-----------------------------
Can anybody help me on how to avoid this uncertainty? BTW, my MATLAB version is R2008a.
Thank you in advance for any response.
Best regards,
Jean
Accepted Answer
More Answers (0)
Categories
Find more on Random Number Generation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!