main.m
上传用户:toja168
上传日期:2015-04-01
资源大小:2k
文件大小:1k
源码类别:

3G开发

开发平台:

Matlab

  1. d=ones(100,16);
  2. for i=1:100
  3.     
  4.     if C(1,i)==1
  5.         k=1;
  6.         for j=1:100
  7.             if C(1,j)==0
  8.                 d(i,k)=distance(X(i),X(j),Y(i),Y(j));
  9.                 k=k+1;
  10.             end
  11.         end
  12.         
  13.         minval=min(d(i,:));
  14.         rr=find(d(i,:))==minval;
  15.         
  16.         m=0;
  17.         for j=1:100 
  18.             if C(1,j)==0
  19.                 m=m+1;
  20.                 if m==rr;
  21.                     w=j;
  22.                 end
  23.             end
  24.         end
  25.         
  26.         x=[X(i),X(w)];
  27.         y=[Y(i),Y(w)];
  28.         plot(x,y)
  29.     end
  30. end