commit 6882c797115e1d2b42fcba12361bc624a9bf1118 Author: facat Date: Sun Dec 7 00:39:00 2014 +0800 第一次提交 Signed-off-by: facat diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..21229f7 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.asv \ No newline at end of file diff --git a/main.m b/main.m new file mode 100644 index 0000000..036d2b7 --- /dev/null +++ b/main.m @@ -0,0 +1,36 @@ +clc +clear +close all +%γɳʼ +center=[1,1,1,1,1;10,10,10,10,10;100,100,100,100,100;1000,1000,1000,1000,1000]; +dataN=100;% ɶٸ +data=zeros(5,dataN); +for I=1:dataN + i=round(1+(5-1)*rand()); + data(:,I)=center(i)*( -1+(1+1)*rand(5,1)); +end + +%ѡһѡ +cddtI=10; +SetS=[]; +SetS=[SetS;cddtI;]; +Cij=0; +for I=1:dataN + if I==cddtI + continue + end + d=data(:,I); + %Ѱ̾ + minD=1e20; + for J=1:length(SetS) + if I==SetS(J) + continue + end + distance=sum((d-data(:,SetS(J))).^2).^.5; + if distance