matlab - Distance calculated between one row of array 1 for every row of array 2 then move on to next row of array 1 and repeat -


I am trying to find the distance between two lists of locations (lat, long). I have all been placed in different arrays, which is lat1, lon1, lat2, lon2. The first set is that I am reading a GPS system and the second is the reference. They have more than 1000 rows.

What I have to do is latitude 2, calculate the distance between L1, loan 1 for all points of loan 2, then take the second row to the next 1, loan 1 again 2, calculate all the lines of loan 2 and repeat.

Therefore, L1, loan 1 wave 2, should be done for every point of loan 2.

I have to finally decide on the basis of output distance & lt; 4

Can anyone help with this? Please hope that you have the statistics toolbox, because you can only use it in pdist2 / code> for:

  pdist2 ([lat1, lon1], [lat2, lon2])   

If you do not have statistics toolbox:

 % // Simple example data a = [0, 0; 0, 1; 1 1]; B = [0, 0; 0, 1; 1 1]; N = size (A, 1); [X, y] = ndgrid (1: n, 1: n) dist = sqrt (zodiac (one (x (:), :) - b (y (:), :)) ^ 2, 2)) Reshape (dist, n, n)   

In the result (right):

  ans = 0.00000 1.00000 1.41421 1.00000 0.00000 1.00000 1.41421 1.00000 0.00000    

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -