4

here is what I want to do (preferably with Matlab):

Basically I have several traces of cars driving on an intersection. Each one is noisy, so I want to take the mean over all measurements to get a better approximation of the real route. In other words, I am looking for a way to approximate the Curve, which has the smallest distence to all of the meassured traces (in a least-square sense).

At the first glance, this is quite similar what can be achieved with spap2 of the CurveFitting Toolbox (good example in section Least-Squares Approximation here). But this algorithm has some major drawback: It assumes a function (with exactly one y(x) for every x), but what I want is a curve in 2d (which may have several y(x) for one x). This leads to problems when cars turn right or left with more then 90 degrees. Futhermore it takes the vertical offsets and not the perpendicular offsets (according to the definition on wolfram).

Has anybody an idea how to solve this problem? I thought of using a B-Spline and change the number of knots and the degree until I reached a certain fitting quality, but I can't find a way to solve this problem analytically or with the functions provided by the CurveFitting Toolbox. Is there a way to solve this without numerical optimization?

4

1 回答 1

0

mbeckish 是对的。为了在曲线形状上获得足够的灵活性,您必须使用参数曲线表示 (x(t), y(t)) 而不是显式表示 y(x)。请参见参数方程

给定曲线上的 n 个连续点,如果您知道,则分配它们的真实时间,如果您不知道,则只分配整数 0..n-1。然后使用向量 T, X 和 T, Y 而不是 X, Y 调用 spap2 两次。现在对于任意 t,您会在曲线上得到一个点 (x, y)。

这不会为您提供真正的最小二乘解决方案,但应该足以满足您的需求。

于 2012-02-18T14:12:09.693 回答