fcm_test.m

来自「模糊核聚类算法的几篇论文及matlab源码」· M 代码 · 共 18 行

M
18
字号
clear
clc
load kes.txt
        data=kes(:,1:2);
        
        [center,U,obj_fcn] = fcm(data,2);
        plot(data(:,1), data(:,2),'o');
        hold on;
%         maxU = max(U);
%         % Find the data points with highest grade of membership in cluster 1
%         index1 = find(U(1,:) == maxU);
%         % Find the data points with highest grade of membership in cluster 2
%         index2 = find(U(2,:) == maxU);
%         line(data(index1,1),data(index1,2),'marker','*','color','g');
%         line(data(index2,1),data(index2,2),'marker','*','color','r');
        % Plot the cluster centers
        plot([center([1 2],1)],[center([1 2],2)],'*','color','k')
        hold off;

⌨️ 快捷键说明

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