Fit an ellipse to a set of boxes.

조회 수: 2 (최근 30일)
Ali Baradaran
Ali Baradaran 2015년 12월 11일
편집: Ali Baradaran 2015년 12월 11일
I have a set of boxes derived from a text file. These boxes are plotted using the patch command, in the following figure:
Now I would like to fit the biggest ellipse possible, inside this set. What is the best way to do so? FYI: The text file contains the vertices of each small box.

답변 (1개)

Alan Weiss
Alan Weiss 2015년 12월 11일
  1. Parametrize an ellipse with a vector x, whose components represent the eccentricity, size, and center (4 dimensions), or any other parametrization you like.
  2. Figure out how you can tell whether, for a given x vector, the ellipse is inside the region. In other words, create a function c(x) that is negative when the entire ellipse is in the region, and is positive when some of the ellipse sticks out of the region, and is smooth.
  3. Write the objective function as negative the area of the ellipse, and the nonlinear inequality constraint is c(x).
  4. Call fmincon from a variety of initial values.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
  댓글 수: 1
Ali Baradaran
Ali Baradaran 2015년 12월 11일
편집: Ali Baradaran 2015년 12월 11일
Thank you for your answer dear Alan,
Regarding your 2nd step: My main problem is that I do not know what this "region" is. How can I convert the text file (which covers the vertices of all small boxes), to a mathematical expression or a function, ... describing this very region?
Best regards,
Ali

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

카테고리

Help CenterFile Exchange에서 Get Started with Curve Fitting Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by