How to calculate the area of the curve around a point?

조회 수: 4 (최근 30일)
Cola
Cola 2021년 10월 11일
댓글: Cola 2021년 10월 16일
There is a curve, and the coordinates of each point of the curve is known. Is there a way to calculate the area of the curve around a point? Thanks!
For example, I plot a curve by Data.mat as shown below, and (0,20) is a point of attraction.
Now I want to calculate the area as shown below by Data.mat.
The whole area can be divided to these parts.

채택된 답변

Image Analyst
Image Analyst 2021년 10월 11일
Someone just posted code from the Mathworks that does the local angle computation. See
  댓글 수: 2
Cola
Cola 2021년 10월 16일
@Image Analyst Thank you very much. And there is a code for reference.
Code:
delta_x=Data(:, 1)-0;
delta_y=Data(:, 2)-20;
L=sqrt(delta_x.^2+delta_y.^2)
a=L(1:2000,1);
b=L(2:2001,1);
for i=1:1:2000
c(i,:)=sqrt((Data(i, 1)-Data(i+1, 1)).^2+(Data(i, 2)-Data(i+1, 2)).^2)
end
p=(a+b+c)./2; %% Heron's formula
S=sqrt((p-a).*(p-b).*(p-c).*p)
Total_S=sum(S)
Cola
Cola 2021년 10월 16일
Eliminating iteration by code:
c1=Data(1:2000,:);
c2=Data(2:2001,:);
c=sqrt((c1(:, 1)-c2(:, 1)).^2+(c1(:, 2)-c2(:, 2)).^2)

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Linear and Nonlinear Regression에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by