Filter löschen
Filter löschen

Calculating global nearest neighbour (GNN) in Matlab

4 Ansichten (letzte 30 Tage)
Mayank Lakhani
Mayank Lakhani am 22 Feb. 2016
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 Kommentar
Jacobo Levy Abitbol
Jacobo Levy Abitbol am 6 Jun. 2016
Check Munkres algorithm for rectangular matrices in file exchange and apply it to your distance matrix to get the GNN optimal assignment

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Automotive finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by