フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Find the Area under a curve for specified values (Limits)

1 回表示 (過去 30 日間)
Vishal Varadraj
Vishal Varadraj 2021 年 11 月 2 日
閉鎖済み: Adam Danz 2021 年 11 月 2 日
I have a vector containing n rows (dependent on user input who gives the start and end time) and 6 columns. The first column is the time every minute and the 6th being the power at each time. I want to find the power from 08:00 to 17:00 everyday for the time defined by the user. Picture below shows this. In order to do so i found the required hours using the code shown below
DayArr = StartDateVec:minutes(1):EndDateVec;
hr = hour(DayArr);
idx(:,1) = hr>=8 & hr<17;
for the whole time period and found the rows for which i need to to extract the power values. I then chucked these required power values into another variable containing 0 for the power between 17:00 to 8:00 and the actual power values from 8:00 to 17:00 as shown below using the code
Timetable.power.*(idx(:,1))
I just need to now find the area of the power curve between these 0 values. Cumtrapz doesn't work because when the power equals 0 the value still remains the same. Any help on how I can find the cumalative power from 8-17:00 and for the remaining time the value should be 0.
I have attached the workspace for you to work with.

回答 (0 件)

この質問は閉じられています。

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by