Info

This question is closed. Reopen it to edit or answer.

Calculating the area of a plot, e.g convhull

1 view (last 30 days)
kenneth lee
kenneth lee on 10 Feb 2020
Closed: MATLAB Answer Bot on 20 Aug 2021
Good day all, i am currently facing a problem where i cant compute the accurate area of my graphs. The problem is i have a data of 240 records and there are numerous shapes and i am supposed to consolidate all their areas, l have managed to get the area by using the convhull code however it is not accurate enough. Please help.
The below following is one of the examples that i need help:
The picture on the left is the convhull and computed area in matlab however i only want the area on the right. So is there a universe code where they will just take whatever shape there is and just compute the area under the curve as i have various shapes below as well.
Really appreciate it if there are some advices given as i really need some help here. l have also attached the three data files and my codes for reference.
close all; clear all; clc;
filename = 'o1-1.txt'
deliminator = ' ';
A = dlmread(filename, deliminator, 14, 0);
A = wdenoise(A,5, ...
'Wavelet', 'db5', ...
'DenoisingMethod', 'Bayes', ...
'ThresholdRule', 'Soft', ...
'NoiseEstimate', 'LevelIndependent');
resistance = A(:,1);
reactance = A(:,2);
delre = max(resistance) - min(resistance);
delim = max(reactance) - min(reactance);
L = sqrt(delre.^2 + delim.^2);
alpha = atan(delim./delre)*180/pi;
xc = resistance;
yc = reactance;
[k, av] = convhull(xc,yc);
plot(xc,yc,'*')
hold on
plot(xc(k),yc(k))

Answers (1)

Steven Lord
Steven Lord on 10 Feb 2020
Consider using an alphaShape instead of a convex hull since your shape isn't convex.

Community Treasure Hunt

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

Start Hunting!