⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 democluster.m

📁 这里包含了聚类的工具箱还有很详细的文档说明
💻 M
字号:
load datacluster

[N,d] = size(X);

M = 25; % number of centroids
L = 200; % number of iterations

centri = 0.1*rand(M,d);
nvori = ones(M,1);


for i = 1:L

    figure(1)
    plot(X(:,1),X(:,2),'g.',centri(:,1),centri(:,2),'ro',centri(:,1),centri(:,2),'r*')
    pause(0.1);
    %pause
    
    modus = 3;
    switch modus
        case 1
            [centro,nvoro] = kmeanscode(X,centri);
        case 2
            [centro,nvoro] = lvqcode(X,centri,i);
        case 3
            [centro,nvoro] = fsclcode(X,centri,nvori,i);
    end
    centri = centro;
    nvori = nvoro;
        
end

figure(2)
subplot('position',[0.3 0.5 0.4 0.4])
plot(X(:,1),X(:,2),'.',centro(:,1),centro(:,2),'r*')

subplot('position',[0.3 0.22 0.4 0.2])
plot(nvoro); axis([1 M 0 N/M*4])

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -