matlab - finding minimum of coordinates points -
we assumed have 10 coordinate points. index minimum?
(1.80010698 , 4.014570409) (9.748210988 , 2.411989898) (13.42264438 , 868.0535382) (11.24015951 , 3.870002979) (1.689561544 , 2.297184285) (1.887080244 , 2.019336807) (9.932550154 , 1.457111369) (9.184472568 , 2.521589242) (5.061231021 , 2.800199182) (3.343124515 , 2.478806307)
i want plot marked points. rest of them not matter.
clc; close all; load('mymatfilename.mat'); [m, ~] = size(inputs); x = inputs(inputs(:,end-1) < 5 & inputs(:,end) < 2, end-1); y = inputs(inputs(:,end-1) < 5 & inputs(:,end) < 2, end); plot(x, y, 'or', 'linewidth', 1.5); grid on
i guessing talking distance x,y coordinates.
you can calculate distance origin using pythagorean theorem.
sample code:
for = 1:length(coordinates) l(i) = (x(i)^2 + y(i)^2)^0.5; end [i,minl] = min(l);
where i
minimum index , minl
minimum distance.
Comments
Post a Comment