我一直在关注这篇论文(特别是关于 Fang 方法的部分),试图使用TDOA 技术解决三边测量问题。
我希望在 Fang / TDOA 方面有经验的人可以帮助我。出于某种原因,我的实现将不正确的根返回到最终的二次方。这是我到目前为止编写的代码:
#include <stdio.h>
#include <math.h>
struct Point {
double x;
double y;
};
inline double sqr(double n) {
return n * n;
}
// r1 and r2 are the TDOA of the sound impulse to p1 and p2, respectively
void fang(double r1, double r2) {
// transmitter coords
Point tx = {0.7, -0.1};
// receiver coordinates
Point p0 = {0, 0};
Point p1 = {1.7320508075688772, 0};
Point p2 = {0.8660254037844388, 1.5};
// linear coefficients
double g = ((r2 * (p1.x/r1)) - p2.x) / p2.y;
double h = (sqr(p2.x) + sqr(p2.y) - sqr(r2) + r2 * r1 * sqr(1 - (p1.x / r1))) / (2 * p2.y);
// quadratic coefficents
double d = -(1 - sqr(p1.x / r1) + sqr(g));
double e = p1.x * (1 - sqr(p1.x / r1)) - (2 * g * h);
double f = (sqr(r1) / 4) * sqr(1 - sqr(p1.x / r1)) - sqr(h);
double result_x = (-e - sqrt(sqr(e) - (4 * d * f))) / (2 * d);
}
int main() {
// these values have been calculated a-priori, from the known transmitter coords
double r1 = 0.32977743096231715;
double r2 = 0.90148404145971694;
fang(r1, r2);
}
最终我希望x_result
等于发射机的 x 坐标 ( tx.x == 0.7
),但令人沮丧的是结果是≈0.237
。
我的确切问题的轮廓(以及它的解决方案,两条双曲线相交的地方)可以在下图中以几何方式查看:
任何帮助将不胜感激!