# find area of curve and update it with given conditions?

1 visualizzazione (ultimi 30 giorni)
MUKESH KUMAR il 24 Set 2019
Commentato: MUKESH KUMAR il 25 Set 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,
find Redarea for each segment/time stamp (RArea1,RArea2,RArea3,RArea4,RArea5, RArea6)
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
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 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Risposte (1)

darova il 24 Set 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 CommentoMostra -1 commenti meno recentiNascondi -1 commenti meno recenti
MUKESH KUMAR il 25 Set 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

Accedi per commentare.

### Categorie

Scopri di più su Particle & Nuclear Physics in Help Center e File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by