Watch this Author's files
Following the analysis of Stuart Layton, I've found a merely faster way to perform the same computation:
d = sqrt(bsxfun(@minus,bsxfun(@plus,sum(a.^2,1),sum(b.^2,1)'),2*(a'*b).'));
Using the same tool as Stuart Layton (modified to have the tic/toc outside the loop), I measure 4.3607ms for distance.m and 4.1252ms for mine. Does not change dramatically, ok.
Hi, I am new to this so how would I exactly inputthis on matlab? if anyone can help me please
Thanks. This saved me time!
I find a simple
faster to compute the Euclidean distance
Thanks. using repmat has made it useful and fast.