Java tutorial
//package com.java2s; //License from project: Apache License public class Main { /** * Calculates distance using Free-space path loss. Constant -27.55 is used for calculations, where frequency is in MHz and distance in meters. * FSPL(dB) = 20 log(d) + 20 log(f) - 27.55; d distance from the transmitter [m], f signal frequency [MHz] * * @param level measured RSSI [dBm] * @param freq WiFi frequency [MHz] * @return distance from AP [m] */ public static double calculateDistance(double level, double freq) { double exp = (27.55 - (20 * Math.log10(freq)) + Math.abs(level)) / 20.0; return Math.pow(10.0, exp); } }