function [U,center,result,w,obj_fcn]= fenlei(data)
[data_n,in_n] = size(data)
m= 2 % Exponent for U
max_iter = 100 % Max. iteration
min_impro =1e-5 % Min. improvement
c=3
[center, U, obj_fcn] = fcm(data, c)
for i=1:max_iter
if F(U)>0.98
break
else
w_new=eye(in_n,in_n)
center1=sum(center)/c
a=center1(1)./center1
deta=center-center1(ones(c,1),:)
w=sqrt(sum(deta.^2)).*a
for j=1:in_n
w_new(j,j)=w(j)
end
data1=data*w_new
[center, U, obj_fcn] = fcm(data1, c)
center=center./w(ones(c,1),:)
obj_fcn=obj_fcn/sum(w.^2)
end
end
display(i)
result=zeros(1,data_n) U_=max(U)
for i=1:data_n
for j=1:c
if U(j,i)==U_(i)
result(i)=j continue
end
end
end
標簽:
data
function
Exponent
obj_fcn
上傳時間:
2013-12-18
上傳用戶:ynzfm
void Knight(int i , int j)
{
// printf("%d %dn",i,j)
if (board[i][j] != 0 || i < 0 || i >= Size || j < 0 || j >= Size )
{
return
}
step++
board[i][j]=step
if (step == Size*Size)
{
showboard()
system("PAUSE")
return
}
//DFS
Knight(i-2,j-1) //left
Knight(i-2,j+1)
Knight(i+2,j-1) //right
Knight(i+2,j+1)
Knight(i-1,j-2) //up
Knight(i+1,j-2)
Knight(i+1,j+2) //down
Knight(i-1,j+2)
//
board[i][j]=0
step--
}
標簽:
int
Knight
printf
board
上傳時間:
2014-01-17
上傳用戶:cxl274287265