Use of trapezoidal function and resampling of time series?

조회 수: 2 (최근 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 CenterFile Exchange에서 Time Series Collections에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by