find maximum of data with some conditions

15 ビュー (過去 30 日間)
MUKESH KUMAR
MUKESH KUMAR 2019 年 9 月 4 日
コメント済み: Neuropragmatist 2019 年 9 月 6 日
I had one year load data of a transformer hourly time interval, so load(365*24, 24) matrix. I want to find out the maximum of each day and that day load(1,24) in each season of the year.
but condition is:
lets say in season 1(March-May)
max load is 500 on 23rd May and its loading duration in some range[450 500] or nearby maximum load duration is only for 4 time slots. but at that season 1 their may be second max is 480 such that that day loading duration is range of [430 480] or nearby maximum load duration is for 10 time slots of that day. In this case I will choose second maximum.
similarly find for all season max load of that day.
thanks
  2 件のコメント
Jan
Jan 2019 年 9 月 4 日
What have you tried so far?
MUKESH KUMAR
MUKESH KUMAR 2019 年 9 月 4 日
I find out the max load of each day, then at max load of a season, I tried to find out the counts, that how much times load is near to maximum in that day(at max load day). Simply, I want to found out that day where load is may be maximum or 2nd/3rd/4th maximum of that season but that maximum day,should be max counts of higher loading.

サインインしてコメントする。

回答 (1 件)

Neuropragmatist
Neuropragmatist 2019 年 9 月 4 日
I really don't understand your question, how are the data arranged? Can you give us an example piece of data?
It sounds like you might want to look at the second output of max (or nanmax) which is the index of the maximum value:
Hope this helps,
M.
  2 件のコメント
MUKESH KUMAR
MUKESH KUMAR 2019 年 9 月 4 日
Data are arrange as rows represent each day from 1,2, 3,....365 and column shows the load hourly for each day(row) 1,2,3,...24. Then find max load for each day and then max counts(max load duration) in each season.
Neuropragmatist
Neuropragmatist 2019 年 9 月 6 日
OK,
Lets make some example data and try some things. Lets just make data for 10 days (so 10 rows) with 24 hours per day (so 24 columns):
dat = rand(10,24)*500; % just some dummy/example data
If I understand correctly you want to find the maximum load for each day, you can do that like this:
max_load = max(dat,[],2);
Now the next part is not very clear - you want to know how many hours each day the load was above a certain threshold? Do these hours have to be contiguous (in one connected block)? If not, you can use something like this:
load_threshold = 400;
hours_above_threshold = sum(dat>load_threshold,2)
If you want the load threshold to change for each day you can also make load_threshold a vector:
load_threshold = max_load-50;
hours_above_threshold_minus_50 = sum(dat>load_threshold,2)
If the hours have to be contiguous you will have to find the values above the threshold you want, find the maximum value, find contiguous regions using bwlabel:
then find which region corresponds to the maximum, then get the size of that region to get contiguous hours above the threshold around the maximum.
Hope this helps,
M.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeDates and Time についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by