find area of curve and update it with given conditions?

1 vue (au cours des 30 derniers jours)
MUKESH KUMAR
MUKESH KUMAR le 24 Sep 2019
Commenté : MUKESH KUMAR le 25 Sep 2019
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
demo.JPG

Réponses (1)

darova
darova le 24 Sep 2019
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?
  1 commentaire
MUKESH KUMAR
MUKESH KUMAR le 25 Sep 2019
I dont want more points, and I took that time stamp where total area is going to nearby zero, untill that time stamp change the curve accordingly and further it will be same, and also need to find separate area for both +ve and -Ve

Connectez-vous pour commenter.

Catégories

En savoir plus sur Programming dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by