研究论文中的算法

问题描述

我正在帮助一位朋友为母校开发项目。其基于this论文。

到目前为止,除需要在Web应用程序中实现的算法外,Web应用程序的80%已完成。在本文内部,有一种算法被研究的支持者使用:

Algorithm 1 proposed method
1. Input data of fingerprints ????,?(?) and (??,??),? = 1,…,? ; ? = 1,?,?
2. Input data of test ???′
?,?
3. for m=1:M do
4.    for l=1: ? do
5.     for j=1:N do
6.      Calculate the Euclidian distance,??,?(?),between ???′?,? and ????,?(?)
7.     end for
8.     Select the minimum (with respect to j) distance ??,? among ?
9.    end for
10. end for
11. Sort each column of the matrix ??×?
in ascending order,to obtain the matrix ???×?.
12. Store the ???ℎ(l = 1,L) element of each column of the matrix ???×? in a vector.
13. Select the RP that has the minimum distance in this vector.
14. Output the coordinates of this RP as the estimated position.

该算法已通过使用MATLAB转换为代码,但是我们正在尝试在项目中使用PHP。问题是我们不能完全理解上面的伪代码。谁能帮助我在某种程度上“简化”它以使其更具可读性或可理解性?非常感谢!

这是本文的算法: this is the screenshot of the algorithm that was used

解决方法

在您提供的屏幕截图中,算法只是可以找到实现的欧几里德距离(https://en.wikipedia.org/wiki/Euclidean_distance)。

例如,这是PHP https://supunkavinda.blog/php-euclidean-distance中的一种实现

您还可以使用已经为您实现的PHP-ML库:https://php-ml.readthedocs.io/en/latest/math/distance/

然后,作者似乎选择了最小的欧几里得距离。您对伪代码有任何具体问题吗?希望这可以帮助!很高兴回答评论中的后续问题。