Java Distance Calculate calculateDistance(double rssi, double txPower)

Here you can find the source of calculateDistance(double rssi, double txPower)

Description

calculate Distance

License

Open Source License

Declaration

public static Double calculateDistance(double rssi, double txPower) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static Double calculateDistance(double rssi, double txPower) {
        double ratio;
        ratio = rssi * 1.0 / txPower;//from   ww  w. j a  va  2 s.c  o  m
        if (ratio < 1.0) {
            return Math.pow(ratio, 10);
        } else {
            double distance;
            distance = (0.89976) * Math.pow(ratio, 7.7095) + 0.111;
            // distance = Math.pow(10, (-rssi + txPower) / (10 * 2));
            // if (distance < Threshold)
            return distance;
            // else
            // return Threshold;
        }
    }
}

Related

  1. calcDistanceIfAccel(double startVelocity, double accel, double targetVelocity, double duration)
  2. calcDistanceToStop(double startingVelocity, double maxDeceleration)
  3. calculateDistance(double lat1, double lng1, double lat2, double lng2)
  4. calculateDistance(Double lng1, Double lat1, Double lng2, Double lat2)
  5. calculateDistance(Double prevLat, Double prevLon, Double currentLat, Double currentLon)
  6. calculateDistance(final double x1, final double y1, final double x2, final double y2)
  7. calculateDistance(float[] vec1, float[] vec2)
  8. calculateDistance(int from, int to)
  9. calculateDistance(int x1, int y1, int z1, int x2, int y2, int z2)