How to avoid uncertainty in processing result of MATLAB Statistics Toolbox
显示 更早的评论
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
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Random Number Generation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!