MATLAB: Fitting data to a limaçon curve

2dcurve fittinglimacon

I have data in the form of two column vectors x and y containing the x and y coordinates of measurements. The data forms a limaçon curve that can be described by the equation (x^2+y^2-a*x)^2 = b^2*(x^2+y^2). How can I fit a curve of that type to my data yielding a and b as results?

Best Answer

Here's a poor man's method, assuming you don't have the Optimization or Curve Fit Toolboxes
z=x.^2+y.^2;
%Cheesy initial guess of p=[a,sqrt(b)]
p= [x, sqrt(z)]\z;
p(2)=max(p(2),0); %b must be positive
%Re-optimize
p0=p;
p=fminsearch(@(p) norm( (z-p(1).*x).^2 - z.*p(2).^2 ), p0 );
a=p(1);
b=p(2)^2;
Related Question