# find maximum of data with some conditions

20 views (last 30 days)
MUKESH KUMAR on 4 Sep 2019
Commented: Neuropragmatist on 6 Sep 2019
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

Jan on 4 Sep 2019
What have you tried so far?
MUKESH KUMAR on 4 Sep 2019
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.

Neuropragmatist on 4 Sep 2019
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.

MUKESH KUMAR on 4 Sep 2019
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 on 6 Sep 2019
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:
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:
If you want the load threshold to change for each day you can also make load_threshold a vector: