Hi, I have been trying t fit a curve to the attached data. I tried fitPolynomialRANSAC but didn't get intended result. The data and the output are attached. Here is the code I used.
plot(idx(:,1),idx(:,2),'*');
set(gca,'XAxisLocation','top','YAxisLocation','left','ydir','reverse');
[P, inlierIdx] = fitPolynomialRANSAC([x y],N,maxDistance);
yRecoveredCurve = polyval(P,x);
plot(x(inlierIdx),y(inlierIdx),'.',x(~inlierIdx),y(~inlierIdx),'r+')
set(gca,'XAxisLocation','top','YAxisLocation','left','ydir','reverse');
plot(x,yRecoveredCurve,'-g','LineWidth',1)
Any help is greatly appreciated.
Edit: Requirement is that the curve should closely follow the point.