Calculating global nearest neighbour (GNN) in Matlab

4 次查看(过去 30 天)
I have two data matrix. One is original data and another is measured data of radar sensor. I want to find out global nearest neighbor (GNN) of the original data from the measured data. I have already calculated the Local nearest neighbor and posted the m file below. My question is how to change it in to Global nearest neighbor.
Number_of_object = 5;
Measured_data = f_range_m(1:numSuperpulsesPerCycle_g:length(timeline_ms),:);
Original_data = OrgiRange(1:numSuperpulsesPerCycle_g:length(timeline_ms),:);
Result_Range= nearest_Distance(Original_data,Measured_data, Number_of_object);
m file for the nearest_Distance (Local nearest neighbor) is give below
function [ res ] = nearest_Distance( Original_data, Measured_data, Number_of_object)
res=nan(size(Original_data,1),Number_of_object);
for ix = 1:Number_of_object
%dist = abs(bsxfun(@minus,Measured_data,Original_data(:,ix)));
dist = abs(bsxfun(@minus,Measured_data,Original_data(:,ix)));
[~,col] = min(dist,[],2);
res(:,ix) = diag(Measured_data(:,col));
end
end
  1 个评论
Jacobo Levy Abitbol
Check Munkres algorithm for rectangular matrices in file exchange and apply it to your distance matrix to get the GNN optimal assignment

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Automotive 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by