我有两个3D矩阵,如下所示。
Original_data = cat(3, O_range, O_Doppler, O_Angle);
Measured_data = cat(3, M_range, M_Doppler, M_angle);
下面是一个m.file,用于计算O_range和M_range之间的最近距离。如何计算O_Doppler&的最近距离? M_doppler和O_angle& M_angle从3D矩阵到循环。
function [ res ] = nearest_Distance( O_range, M_Range, Number_of_object)
res=nan(size(O_range,1),Number_of_object);
for ix = 1:Number_of_object
dist = abs(bsxfun(@minus,M_Range,O_range(:,ix)));
[~,col] = min(dist,[],2);
res(:,ix) = diag(M_range(:,col));
end
end