Best fit of ellipse equation to given data

조회 수: 30 (최근 30일)
Serg
Serg 2020년 12월 27일
댓글: Bruno Luong 2021년 1월 12일
Hello everyone,
For the given ellipse equation denoted as follows:
with additional parameters of mc and PIc to include a rotation of the ellipse:
I need to find
  1. a and b (semi-major and semi-minor axes),
  2. y0 and x0 (center coordinates), and
  3. theta(rotation angle)
to have best fitted ellipse into my data which is give in the form of PI = f(m) with around 5-8 test points per dataset.
Given the fact that my data has various shapes I do not expect the ellipse to be very precise, but still I would like the best I can get out of this method. I have tried to achieve that with Curve Fitting app, using Custom Equation option, but the equation I have put into it was too complex (some errors occurred).
Can you please advice, what would be the most convenient way to achieve my goal?
Kind Regards

채택된 답변

Bruno Luong
Bruno Luong 2020년 12월 27일
  댓글 수: 5
Serg
Serg 2021년 1월 12일
It seems to work!
Just to assure myself:
  • "radii" contains semi-major and semi-minor axes;
  • "xc" and "yc" are center points;
  • "U" contains trygonometric functions of rotation angle;
Is that correct?
I am a bit confused, because if I use those to my initial equation, and input x(pi) as known, resultant y is far from what I would expect.
To solve the equation I use simple code:
Y = sym('Y');
a = max(radii);
b = min(radii);
deg = 143.8757;
x0 = xc;
y0 = yc;
X = 2
XC = X*cosd(deg) - Y*sind(deg);
YC = X*sind(deg) + Y*cosd(deg);
alpha = ((XC - x0)/a)^2;
beta = ((YC - y0)/b)^2;
[solY] = solve(alpha + beta == 1)
Y = vpa(solY)
Bruno Luong
Bruno Luong 2021년 1월 12일
"Just to assure myself:
  • "radii" contains semi-major and semi-minor axes;
  • "xc" and "yc" are center points;
  • "U" contains trygonometric functions of rotation angle;
Is that correct?"
Yes, you correctly understand.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

제품


릴리스

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by