資源簡介
這是一個計算歐式距離的matlab程序,本人使用過,很好用。
代碼片段和文件信息
function?d?=?euclidean(abdf)
%?EUCLIDEAN?-?computes?Euclidean?distance?matrix
%
%?E?=?euclidean(AB)
%
%????A?-?(DxM)?matrix?
%????B?-?(DxN)?matrix
%????df?=?1?force?diagonals?to?be?zero;?0?(default)?do?not?force
%?
%?Returns:
%????E?-?(MxN)?Euclidean?distances?between?vectors?in?A?and?B
%
%
%?Description?:?
%????This?fully?vectorized?(VERY?FAST!)?m-file?computes?the?
%????Euclidean?distance?between?two?vectors?by:
%
%?????????????????||A-B||?=?sqrt?(?||A||^2?+?||B||^2?-?2*A.B?)
%
%?Example?:?
%????A?=?rand(400100);?B?=?rand(400200);
%????d?=?distance(AB);
%?Author???:?Roland?Bunschoten
%????????????University?of?Amsterdam
%????????????Intelligent?Autonomous?Systems?(IAS)?group
%????????????Kruislaan?403??1098?SJ?Amsterdam
%????????????tel.(+31)20-5257524
%????????????bunschot@wins.uva.nl
%?Last?Rev?:?Wed?Oct?20?08:58:08?MET?DST?1999
%?Tested???:?PC?Matlab?v5.2?and?Solaris?Matlab?v5.3
%?Copyright?notice:?You?are?free?to?modify?extend?and?distribute?
%????this?code?granted?that?the?author
- 上一篇:GMM的matlab實現集合
- 下一篇:遺傳算法用于數字濾波器的設計實驗報告
評論
共有 條評論