Use of trapezoidal function and resampling of time series?

3 ビュー (過去 30 日間)
Jonas
Jonas 2016 年 1 月 12 日
コメント済み: Titus Edelhofer 2016 年 1 月 13 日
Consider the following data set / timeseries (ts):
time val
0 1
5 1
5 4
10 4
10 3
15 3
The timeseries is continuing step/stair-wise. In this case, I want to resample the time series into values sectioned into a 3-minute interval, such as:
resample(ts,0:3:15)
I want matlab to find the new values at [0,3,6,9,12,15], representing a new stair/step-graph with a value valid for three minutes, until the next point appears. Whereas the point 0 should be equal (1*3)/3 = 1 based on the first time interval (0-5), the point 3 is computed as (2*1+4*1)/3 and should thus be 2.
I have thought of using the trapezoidal rule to get the results, but I don't know how to implement it in resample, or synchronization with a new ts. Any hints?
  2 件のコメント
Titus Edelhofer
Titus Edelhofer 2016 年 1 月 13 日
Hmm, I'm not sure what the result should be: if the value is 1 from t=0 until t=5, why should for the resampled signal the value at t=3 should be different from 1? Please give (again) an example what you expect at t=0, 3, 6, 9, 12.
Titus
Titus Edelhofer
Titus Edelhofer 2016 年 1 月 13 日
Forget the comment, I now see what you mean. The value at three is the mean value of the signal on the interval [3 6]. Therefore you mentioned the trapezoidal rule. I admit right now I have no easy solution that would not require looping over the vector 0:3:15 ...
Titus

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeTime Series Collections についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by