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

4 visualizzazioni (ultimi 30 giorni)
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.

Risposta accettata

Image Analyst
Image Analyst il 11 Ott 2021
Someone just posted code from the Mathworks that does the local angle computation. See
  2 Commenti
Cola
Cola il 16 Ott 2021
@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 il 16 Ott 2021
Eliminating iteration by code:
c1=Data(1:2000,:);
c2=Data(2:2001,:);
c=sqrt((c1(:, 1)-c2(:, 1)).^2+(c1(:, 2)-c2(:, 2)).^2)

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by