find area of curve and update it with given conditions?
조회 수: 1 (최근 30일)
이전 댓글 표시
I had a load curve (30 min interval 48 values) , and two different levels of curve(red, black horizontal line in pic), Now I want to find out the area of the curve, above the red line and below the black line, for each time stamp, Condition is such that,
If load>Red line
find Redarea for each segment/time stamp (RArea1,RArea2,RArea3,RArea4,RArea5, RArea6)
untill next segment: load<black line
find Yellow area (YArea1, YArea2, ...........YArea5)
untill RArea1+RArea2+RArea3+RArea4+RArea5+RArea6-YArea1-YArea2-YArea3........= zero or near to zero
if total area not zero condition, then futher calculate Green area in each segment untill the condition meet.
(Note: Uper area of red line take +ve and below black line is -Ve , so add segment wise with sign untill total area is near to zero)
then update the curve like following,
for i=1:48
load>red line
load=redline
load <blaack line
load = black line
end
It should be updated only that untill where zero condtion meet, lets say conditon meet at 38th time stamp then further curve not changed according to above loop.
Thanks
댓글 수: 0
답변 (1개)
darova
2019년 9월 24일
I'd like to interpolate data to get more points
% x,y - you data
x1 = linspace(x(1),x(end),more_points);
y1 = interp(x,y,x1);
Then use find() to find indices where y1>red
Use diff() to find/separate red and green areas
The same for yellow area
Did it help?
참고 항목
카테고리
Help Center 및 File Exchange에서 Particle & Nuclear Physics에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!