main.asv
上传用户: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.           
  19.             if C(1,j)==0
  20.                 m=m+1;
  21.                 if m==rr;
  22.                     w=j;
  23.                 end
  24.             end
  25.         end
  26.         
  27.         x=[X(i),X(w)];
  28.         y=[Y(i),Y(w)];
  29.         plot(x,y)
  30.     end
  31. end