Use of trapezoidal function and resampling of time series?
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Titus Edelhofer
le 13 Jan 2016
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
le 13 Jan 2016
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
Réponses (0)
Voir également
Catégories
En savoir plus sur Time Series Collections dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!