• 大小: 2KB
    文件类型: .m
    金币: 1
    下载: 0 次
    发布日期: 2021-06-03
  • 语言: Matlab
  • 标签: 欧式距离  matlab  

资源简介

这是一个计算欧式距离的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

评论

共有 条评论