필터 지우기
필터 지우기

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