train = [ 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0 1 0 0 0 1 0 1 0 1 0 ];
test = [ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 ];
train1 = train ./ repmat(log(sum(train,2)),[1,size(train,1)]);
train1(isnan(train1)) = 0; train1(isinf(train1)) = 0; % 将除数为0得到的异常值置为0
sim = train * train1; clear train1;