AUC or trapz for irregular shape that intersects itself
이전 댓글 표시
I am trying to figure out how to calculate area under the curve (AUC) for an irregular shape that intersects itself several times. The data is the length and force of a muscle that creates a thing called "work loops". The area inside of the loops are considered negative (clockwise directionality) and positive (counter-clockwise direcrtinality) work. If I could know both negative and positive work, that would be great. Although I will settle for overall work done or area inside.
I have used trapz, but that seems to not give me a consistent postive or negative number. Additionally, I cannot subset the data because the indexes needed to subset are not consecutive in some areas.
WL_1546Fa = readmatrix('~/Desktop/NAU LAB/Data/Rat/Experiments/1546/1546_WL.csv','Range','C23:C1427'); %this is where it is on my computer and hwat I need selected
WL_1546La = readmatrix('~/Desktop/NAU LAB/Data/Rat/Experiments/1546/1546_WL.csv', 'Range', 'F23:F1427'); %same here
plot(WL_1546La, WL_1546Fa); %plotting to see

trapz(WL_1546La, WL_1546Fa)
(The graph goes from left to the loop on the right and then turns back on itself to cross around 0.6 and create the other loops)
댓글 수: 1
Star Strider
2022년 8월 3일
채택된 답변
추가 답변 (1개)
Perhaps as follows?
p=polyshape(WL_1546La, WL_1546Fa);
Areas=area(regions(p))
카테고리
도움말 센터 및 File Exchange에서 Numerical Integration and Differentiation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
