How to get the area of round-like shape more correctly?
조회 수: 9 (최근 30일)
이전 댓글 표시
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
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
2021년 8월 8일
Poster said "So the shape is round-like but not a really circle." That implies a continuous curve.
채택된 답변
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
d_theta = 2*Pi/360;
theta2 = theta1 + d_theta
eqn = x^2/a^2 + y^2/b^2 == 1
x1 = r1*sin(theta1); y1 = r1*cos(theta1);
x2 = r2*sin(theta2); y2 = r2*cos(theta2);
eqn1 = subs(eqn, [x, y], [x1, y1])
eqn2 = subs(eqn, [x, y], [x2, y2])
sol1 = solve([eqn1, eqn2], [a, b], 'returnconditions', true)
sa = simplify(sol1.a)
sb = simplify(sol1.b)
simplify(sol1.conditions)
R = 10 + randi([-3 3], 1, 2)/10
valid = simplify(subs(sol1.conditions, [theta1, r1, r2], [0,R]))
sa = simplify(subs(sol1.a(valid), [theta1, r1, r2], [0,R]),5)
vpa(sa)
sb = simplify(subs(sol1.b(valid), [theta1, r1, r2], [0,R]),5)
vpa(sb)
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
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
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
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 Center 및 File Exchange에서 Eigenvalue Problems에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!