Cumulative sum for every 15min from 1 min timeseries data

2 ビュー (過去 30 日間)
Meh
Meh 2014 年 2 月 17 日
コメント済み: Jos (10584) 2014 年 2 月 17 日
I have a precitpitation data at every 1 min interval. I want to change the timeseries to make a cumulative sum at every 15 min, in order to create a 15-min precipitation data. Which command would be the most suitable for this? Any Help?

採用された回答

Jos (10584)
Jos (10584) 2014 年 2 月 17 日
Do you want to sum up the 15 minutes to a single number and then proceed to the next 15 minutes?
V = ceil(5*rand(33,1)) ; % some 33 arbitrary values
T = 0:numel(V)-1 ; % time stamps
interval = 15 ;
ix = 1+floor((T-T(1))/interval)
V2 = accumarray(ix(:),V(:))
isequal(V2(1),sum(V(1:interval))) % check
  2 件のコメント
Meh
Meh 2014 年 2 月 17 日
Great! Thanks Jos! I have one question though, why did you take T(1)? istn T(1) always zero?
Jos (10584)
Jos (10584) 2014 年 2 月 17 日
Only if you define it as such! By subtracting T(1) from the time data you are sure that the indices correspond to the right indices (intervals), otherwise they might be shifted. The subtraction ensures that the first points within Interval from T(1) receive the index 1, etc ...

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeString Parsing についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by