knn.m
来自「核密度(KDE)估计程序 开发环境matlab」· M 代码 · 共 20 行
M
20 行
function [neighbors, distance] = knn(kde,points,k)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% [neighbors, distance] = knn(kde,points,k)
%
% Find the k nearest neighbors to the point set 'points' (an Ndim x Npts
% double array) within the kde. The neighbors are returned as a set
% of indices (neighbors); the optional second return value is the
% distance to the k^th nearest neighbor. Note that the
% nearest neighbor of a point can include the point itself,
% i.e. a point of distance 0.
%
% See also: kde, getPoints
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright (C) 2003 Alexander Ihler; distributable under GPL -- see README.txt
%#mex
error('MEX-file kde/knn not found -- please recompile if necessary');
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?