predicting true path of data fitted to bezier curve

51 views Asked by At

I have a set of data (x-y GPS points) that represent traversing a well-defined path multiple times. I want to statistically predict the true location of the path and estimate how accurate the prediction is. I have ordered the data and then fit it to a cubic Bezier curve:

% fit the curve
[px, r_x, J_x, CovB_x, mse_x] = nlinfit(t,xOrdData, @bezier, x0);
[py, r_y, J_y, CovB_y, mse_y] = nlinfit(t,yOrdData, @bezier, y0);

% calculate the predicted confidence interval @ 99% certainty
[xpred,xdelta] = nlpredci(@bezier,t, px, r_x, "Covar", CovB_x, "MSE", mse_x, "Alpha", 1-0.99);
[ypred,ydelta] = nlpredci(@bezier,t, py, r_y, "Covar", CovB_y, "MSE", mse_y, "Alpha", 1-0.99);
x_lower = xpred - xdelta;
x_upper = xpred + xdelta;
y_lower = ypred - ydelta;
y_upper = ypred + ydelta;

% plot the results
figure;
hold on;
plot(xOrdData, yOrdData, '.r');
plot(bezier(px,t), bezier(py,t),'-g');
plot(px,py,"*k");
plot(x_lower,y_lower,'k');
plot(x_upper,y_upper,'k');


function retval = bezier(p, t)
    if size(t,1)>size(t,2)
        t=t';
    end
    TT=[(1-t).^3; 3*(1-t).^2.*t; 3*(1-t).*t.^2; t.^3];
    retval = p*TT;
end

The plot that this generates looks like this: plot of data along path And zoomed in: zoomed in

Now, the question here is: why I'm not seeing a larger region of uncertainty? There does not seem to 95% of data points within the region shown. Have I miss-used the MATLAB tools by fitting a parametric curve, x=F(t) and y=G(t)? Something else?

0

There are 0 answers