Package PamUtils

Class BearingMean

java.lang.Object
PamUtils.BearingMean

public class BearingMean extends Object
Calculate the mean of a load of angles in degrees.

This is tricky, since the mean of 359 and 1 is 0, so the first thing to do is to try to find the centre of where most angles are, then we calculate all angles relative to that reference point, and finally, get the mean.

Strategy is to calculate a unit vector for each bearing, then take the mean vector. If all bearings cancel each other out, then the bearing returned will be NaN.

function has been put into a class like this so that it can go further and calculate the standard deviation as well should it feel like it.

Author:
Doug Gillespie.
  • Constructor Details

    • BearingMean

      public BearingMean(double[] bearings)
  • Method Details

    • getBearingMean

      public double getBearingMean()
      Returns:
      the bearingMean
    • getBearingSTD

      public double getBearingSTD()
      Get the standard deviation about the mean.
      Returns:
      the standard deviation about the mean.
    • getBearingR

      public double getBearingR()
      Magnitude of resultant vector r. This quantity is used for calculating circular variance, circular standard deviation
      Returns:
      R - the magnitude of the resultant vector
    • getBearingSTD2

      public double getBearingSTD2()
      The standard deviation of as defined by Zar (1999) sqrt(2*(1-R))
      Returns:
      Circular standard deviation