How to get the area of round-like shape more correctly?

조회 수: 9 (최근 30일)
Lin Ming Che
Lin Ming Che 2021년 8월 7일
댓글: Bjorn Gustavsson 2021년 8월 9일
I have a set of radiuses with same interval angle of 0.1 degrees.
The radiuses are about the same but a little difference.
For example,[ 10.1 10.12 10.11 10.09 ...].
So the shape is round-like but not a really circle.
I use circular sector area formula to get sector area of each radiuses and sum all of them to get the round-like shape's area.
Are there any inetrpolation method or integral method in Matlab can help me to improve the area calculation?
  댓글 수: 7
Scott MacKenzie
Scott MacKenzie 2021년 8월 8일
Well, I don't see anything in the question about a continuous curve being modeled. Perhaps the data are empirical -- measurements taken radially of a property that fluctuates at random. Or perhaps the fluctuation is due to noise in the instrument. So, I saw the question in fairly simple terms. But, @Lin Ming Che accepted your answer, so you're probably right.
Walter Roberson
Walter Roberson 2021년 8월 8일
Poster said "So the shape is round-like but not a really circle." That implies a continuous curve.

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

채택된 답변

Walter Roberson
Walter Roberson 2021년 8월 7일
Assume that the center of the near-circle is at (0,0) .
Now, for any two adjacent points, you can fit an ellipse through the points
Pi = sym(pi);
syms a b r1 r2 d_theta positive
syms x y theta1 real
theta1 = 2*Pi*randi([0 359])/360
theta1 = 
d_theta = 2*Pi/360;
theta2 = theta1 + d_theta
theta2 = 
eqn = x^2/a^2 + y^2/b^2 == 1
eqn = 
x1 = r1*sin(theta1); y1 = r1*cos(theta1);
x2 = r2*sin(theta2); y2 = r2*cos(theta2);
eqn1 = subs(eqn, [x, y], [x1, y1])
eqn1 = 
eqn2 = subs(eqn, [x, y], [x2, y2])
eqn2 = 
sol1 = solve([eqn1, eqn2], [a, b], 'returnconditions', true)
sol1 = struct with fields:
a: [4×1 sym] b: [4×1 sym] parameters: [1×0 sym] conditions: [4×1 sym]
sa = simplify(sol1.a)
sa = 
sb = simplify(sol1.b)
sb = 
simplify(sol1.conditions)
ans = 
R = 10 + randi([-3 3], 1, 2)/10
R = 1×2
9.9000 9.8000
valid = simplify(subs(sol1.conditions, [theta1, r1, r2], [0,R]))
valid = 
sa = simplify(subs(sol1.a(valid), [theta1, r1, r2], [0,R]),5)
sa = 
vpa(sa)
ans = 
10.62005020475202152256927138888
sb = simplify(subs(sol1.b(valid), [theta1, r1, r2], [0,R]),5)
sb = 
vpa(sb)
ans = 
5.3239078115062981895990085871548
Then, with a and b in hand, you should be able to calculate the area of the sector of the ellipse.
However... the equation I used here is for a non-rotated ellipse. For non-rotated ellipses, at theta1 = 0, then the radius at the next location must be strictly less than the radius at theta == 0. Also, if the difference in radii is too large, the code will fail to find a solution, again reflecting the constraints of non-rotated ellipses.
  댓글 수: 1
Walter Roberson
Walter Roberson 2021년 8월 8일
An alternate approach might be to take each group of three adjacent points, and find a circle that passes through the three points, and calculate the sector area of that; https://www.futurelearn.com/info/courses/maths-linear-quadratic/0/steps/12130 for the circle fitting.
This would have the difficulty that each sector is counted twice, with slightly different models. As a first approximation, you could divide the total by 2... but you can probably do better.

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

추가 답변 (1개)

Image Analyst
Image Analyst 2021년 8월 8일
What about using polyarea to compute the area of each (nearly circular) polygon?
% I have a set of radiuses with same interval angle of 0.1 degrees.
angles = 0 : 0.1 : 360;
% The radiuses are about the same, but a little different.
% For example,
radii = [10.1 10.12 10.11 10.09]
% Compute the area for each "circle" (actually a polygon) using polyarea().
for k = 1 : length(radii)
x = radii(k) * cosd(angles);
y = radii(k) * sind(angles);
% Plot circle.
plot(x, y, '-');
grid on;
hold on;
% Compute area.
thisArea(k) = polyarea(x, y);
fprintf('The area of the polygon for radius = %.2f = %f.\n', radii(k), thisArea(k));
end
You get
The area of the polygon for radius = 10.10 = 320.473704.
The area of the polygon for radius = 10.12 = 321.744163.
The area of the polygon for radius = 10.11 = 321.108619.
The area of the polygon for radius = 10.09 = 319.839417.
Is that what you mean?
  댓글 수: 8
Scott MacKenzie
Scott MacKenzie 2021년 8월 9일
Ah, yes. Noted. Thanks.
Bjorn Gustavsson
Bjorn Gustavsson 2021년 8월 9일
@Walter Roberson: It will only underestimate a sector-area in the case that the curve is convex, which it might be but that is not necessarily so since you will have sectors where the radius is smaler than their neighbours. For such sectors it seems to be a bit peculiar to assume that they are circle-sectors...

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

카테고리

Help CenterFile Exchange에서 Eigenvalue Problems에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by