How to match up two lists of data with differing time intervals?

12 Ansichten (letzte 30 Tage)
Matt
Matt am 6 Jul. 2012
I'm trying to correlate time stamped data from two lists (for example, the data in the first list starts at 00:00 and is sampled every ten minutes while the data in the second list starts at 00:03 and is sampled every fifteen minutes). I am supposed to match up the data at even five minute increments. My plan was to use interp1 to interpolate the data to every minute then somehow pick data every five minutes from that, but I'm not sure how to execute the second part. Is there a way to do this? Or maybe an easier way to approach the problem?
Thanks!

Antworten (1)

Ken Atwell
Ken Atwell am 6 Jul. 2012
Interpolating down to one-minute intervals is a reasonable first step. Now, how to grab every fifth minute after that? Using your example, with the first source (I'll call is A) starting at time zero, and the second (B) starting at 3 minutes, it could be a simple as:
subA = A(4:5:end);
subB = B(1:5:end);
When indexing,
  • The first number is the starting index
  • The second number (optional) is the stride, or skip count
  • The third number is the last index; "end" is a special keyword to indicate the last element
Note I start with the 4th element in the A indexing operation. Because MATLAB is 1-indexed, and array A begins at time zero (not one), index four is timestamp 3.
If subA and subB are then different lengths (i.e., the sampling ended at different times too), you might need to trim the longer vector to the length of the shorter one before you can calculate correlate and such.

Kategorien

Mehr zu Interpolation finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by