How to find the distance between pionts? Pls Help

Status
Not open for further replies.

Rihanna

Junior Member level 1
Joined
Jul 24, 2012
Messages
17
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,396
Hello My Friends

I am trying to find the distance from 1,1 to all other points then from 2,1 to all other points then from 3,1 to all other points ...........etc, until from 3,3 to all other points .
I used this function in Matlab and i got the answer

arclen = distance('gc',[37,-76],[37,-9]);arclen1 = distance('gc',[37,-76],[37,-9]) and i got the answer,

However i need some help to write the full program for these 9 points, could you please try to help?



Note: all the points are real on the map an has ( longitude) and ( latitude ).


regards
 
Last edited:

You have 9 locations (loca = 1 through 9).

You'll create 2 nested FOR-NEXT loops.

FOR counter_a = 1 to 9
FOR counter_b = (counter_a + 1) to 9
(add a routine to skip cases where counter_a = counter_b)

At the beginning of the program you stored the x values in x(loca) and the y values in y(loca).

Calculate distance between the current pair of points x(counter_a), y(counter_a) and x(counter_b), y(counter_b).

Store in an array named 'dist (counter_a, counter_b)'

That's the general idea. You'll have to fill in the details.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…