フィルターのクリア

Grouping different time series on the same timescale

9 ビュー (過去 30 日間)
Chris
Chris 2012 年 4 月 12 日
Hello,
I have about 50 different, independent datasets (time series) that I would like to align to be the same size (same temporal resolution and timeframe, etc). Some of these records go back 1,000 years or longer so I'll just pick a timeframe I want to stick with. I know I'll have to do some linear interpolation, but here's a few examples of what the datasets might look like. The first values would be the year and the next would be the dependent variable.
Dataset 1)
1900 value1
1901 value2
1905 value3
1907 value4
Dataset 2)
1900.3 value5
1900.9 value6
1901.4 value7
Dataset 3)
1900 value8
1907 value9
1913 value10
and so on...
Each dataset is currently a different file, but I'd like one file where I can still plot each record as a function of time (but all of the same length for some statistics I want to do).
Many of these records do not have the same temporal resolution, are missing data, some are reported as a fraction of a year, etc. I don't mind degrading the high resolution records a bit and losing some information, and I don't mind rounding values like "1900.33" to 1900.
Any ideas on how to quickly do this in matlab?

回答 (1 件)

Geoff
Geoff 2012 年 4 月 13 日
This is not very efficient, but is easy if you are in a hurry.
Y = 1900:2012; % reference years
V = nan( numel(Y), 50 ); % values for all data sets
D1 = [1900 1; 1901 2; 1905 3; 1907 4];
D2 = [1900.3 5; 1900.9 6; 1901.4 7];
V( ismember(Y,round(D1(:,1))), 1 ) = D1(:, 2);
V( ismember(Y,round(D2(:,1))), 2 ) = D2(:, 2);
However, in D2's case, the 1900.9 and 1901.4 correspond to the same year: 1901. So only one value will be written. If you want to add those values together, this might not be the best approach.
  2 件のコメント
Geoff
Geoff 2012 年 4 月 13 日
PS: use floor instead of round if you just want to discard the fractional part of the year.
Oleg Komarov
Oleg Komarov 2012 年 4 月 13 日
Additionally, I would recommend some sort of interpolation for placing the values.

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

カテゴリ

Help Center および File ExchangeShifting and Sorting Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by