I need to convert the RSSI value as distance and there is a mathematical expression available for the same to convert i.e.,
d = 10 ^ ((TxPower -Rssi) / 10n) (n ranges from 2 to 4)
It is very difficult to choose the "n" value and it gives me the inaccurate results.
Another method is, nonlinear regression model. Which one gives the best result, as I need to feed the distance values to trilateration technique?
I would like to mention that it has been determined by the industry that RSSI is a poor estimator for distance. Various factors like reflections, scattering of signals, and other physical properties of the environment make RSSI unsuitable for distance estimation. You can do a quick search yourself to find a number of articles and papers on this subject.
The RSSI value reported by most BLE devices does generally follow a "closer/stronger, farther/weaker" pattern, but using this data for something precise is not typically possible due to the nature of the BLE protocol (adaptive frequency hopping, short packets, etc.) and the behavior of 2.4 GHz radio signals in normal environments.
sources: