Is there any function for calculate the area content bounded by the curve?
Show older comments
Dear all
I have this curve:

and I would like to calculate the area content, which is bounded into this curve. Is there any functions for this? Thank you for your answers.
Answers (1)
Star Strider
on 24 Apr 2017
0 votes
The polyarea function will probably do what you want.
12 Comments
Veronika
on 24 Apr 2017
Star Strider
on 24 Apr 2017
This works with the cell2mat function:
d = load('tmp.mat');
Data = cell2mat(d.tmp);
A = polyarea(Data(:,2), Data(:,1));
figure(1)
plot(Data(:,2), Data(:,1))
grid
axis equal
text(median(Data(:,2)), median(Data(:,1)), sprintf('Area = %.0f',A), 'HorizontalAlignment','center')
I apologise for the delay. Firefox only wanted to download your ‘.mat’ file as a text file (even after doing the upgrade), so I had to switch to Internet Explorer.
Veronika
on 24 Apr 2017
Star Strider
on 24 Apr 2017
My pleasure.
If your data in ‘tmp’ are derived from another source, you will have to scale the area to the units in your original data.
The easiest way to do that is to scale your x and y data to those units. The area should then be correct.
Veronika
on 24 Apr 2017
Star Strider
on 24 Apr 2017
You have to find them from your original data. For example, if they are pixel data, you have to know the size of the pixels in terms of the original image. If you know the physical dimensions your image represents, and the number of pixels in it in each dimension, you can calculate the size of each pixel in actual length units in each dimension. That becomes your scale in each dimension.
Veronika
on 25 Apr 2017
Star Strider
on 25 Apr 2017
What is the radius of the circle (in length units, such as centimetres)? (My guess would be about 25 cm, but I do not have that information.)
Veronika
on 25 Apr 2017
Star Strider
on 26 Apr 2017
I am not certain what sort of plot the ‘show_fem’ function produces. I cannot find it in an Internet search.
See if the rotate function will work with it. Otherwise the view function could work.
Walter Roberson
on 26 Apr 2017
Star Strider
on 26 Apr 2017
@Walter — Thank you.
Looking through the code, using the view function, or rotating it manually in the GUI, would seem to provide the best option.
Categories
Find more on Whos in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
