Understanding of the function 'dist'

Hi everyone,
So here's my problem - I am considering two points, let's say A and B, and I would like to know the heading of the point A from the point B (i.e. the angle between A and B and the direction of A - if A is going towards B or further away). For this, I am using the function [RANGE,AF,AR]= dist(lat,lon) as follows:
[rangeMeter,AF,AR] = dist([B.lat A.lat],[B.lon A.lon]);
My concern is that I do not really understand the results I got - how to understand the forward (AF) and reverse (AR) bearing ? Are there any similar functions that could lead me to what I want to find ?
Any help would be so much appreciated! Thanks!

4 Comments

I can't see any dist function in Matlab apart from in the Neural Networks toolbox so I'm not sure which function you are using.
Can you not just do the maths as is though? Surely you just need to subtract the longitude and latitude of B from those of A to get the distance and direction and then do some trigonometry to get the angle?
justine
justine on 12 Aug 2014
Edited: justine on 12 Aug 2014
Yes, this is the dist function from the Neural Networks toolbox. I am currently processing the results I got in order to understand - This is the "forward" and "reverse" bearings name that make me confuse about the results. I got an AF bearing of 353.15° - it should be the forward bearing, but what does mean "forward bearing" ?
I'm gonna try to get the direction/heading of A by doing the maths as you suggest it - this may effectively help me to understand!
NB: my point A corresponds to a vessel and my point B is an hydrophone, if it can help understanding my concern - I have to take into account the depth of the hydrophone.
Adam
Adam on 12 Aug 2014
Edited: Adam on 12 Aug 2014
I don't have the Neural Networks toolbox myself, but it sounds to me as though it is tailored towards specific cases of Neural Networks and if you just want general euclidean maths I would recommend keeping it simple. That is, unless I misunderstand your problem and you are in fact using Neural Networks
In this case I can't think of any builtin functions that will do all that you want, just trigonometry components.
justine
justine on 12 Aug 2014
Edited: justine on 12 Aug 2014
Okay so I finally got it! This is not a function from the Neural Networks toolbox, my mistake. It appears to be a function from WHOI ( http://staff.washington.edu/dushaw/WOA/dist.m )
After lots of calculus and simulation, I managed to understand the "forward and reverse" bearings name - it depends of the position of my point A and B. The forward bearing is for example the direction of the line between A to B and the reverse is from B to A. Forward and reverse bearings differ by + or - 180°.

Sign in to comment.

 Accepted Answer

To try to understand any function, first use the commands help, doc and type
help dist
doc dist
type dist
Then examine the examples in detail
Finally, search the NEWSGROUP and ANSWERS for posted applications.
Hope this helps.
Thank you for formally accepting my answer
Greg

More Answers (0)

Categories

Find more on Deep Learning Toolbox in Help Center and File Exchange

Products

Asked:

on 12 Aug 2014

Edited:

on 12 Aug 2014

Community Treasure Hunt

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

Start Hunting!