tempdeg = repmat((sum(train,2)).^0.5,[1,size(train,1)]); //.^ 為開(kāi)根元素
tempdeg = tempdeg .* tempdeg';?
sim = train * train; % 分母的計(jì)算?
?sim = sim./tempdeg? % 分子的計(jì)算
sim(isnan(sim)) = 0;
?sim(isinf(sim)) = 0;?
?repmat((sum(train,2)).^0.5,[1,5]);