我有以下时间序列:
Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
1948 24.786 24.767 25.117 25.514 26.565 27.374 27.778 28.022 27.827 27.308 26.545 25.620
1949 25.191 24.962 25.038 25.591 26.325 27.044 27.719 28.059 28.077 27.541 26.501 25.568
1950 24.713 24.461 24.682 25.122 26.157 26.965 27.688 28.072 28.089 27.429 26.318 25.194
1951 24.423 24.114 24.335 25.153 26.399 27.474 28.143 28.547 28.441 27.854 26.904 25.842
1952 25.025 24.812 25.317 25.734 26.660 27.615 28.069 28.468 28.384 27.738 26.640 25.402
1953 24.619 24.614 25.048 25.917 26.870 27.485 28.021 28.363 28.311 27.687 26.768 25.829
1954 25.176 24.804 25.089 25.768 26.579 27.222 27.684 28.053 27.971 27.164 26.141 25.162
1955 24.553 24.340 24.679 25.266 26.182 26.959 27.649 28.108 28.053 27.453 26.594 25.483
1956 24.492 24.361 24.791 25.446 26.295 26.867 27.505 27.946 27.889 27.420 26.347 25.504
1957 24.928 24.811 25.110 25.690 26.677 27.566 28.221 28.486 28.459 27.793 26.889 25.794
1958 24.982 24.616 25.134 25.940 26.842 27.887 28.421 28.758 28.712 28.085 27.185 26.233
1959 25.432 25.376 25.469 25.987 26.726 27.424 28.042 28.242 28.349 27.988 26.962 26.049
1960 25.364 25.060 25.195 25.877 26.907 27.645 28.187 28.427 28.344 28.002 27.124 25.859
1961 25.194 25.116 25.415 25.907 26.755 27.363 27.960 28.269 28.224 27.672 26.792 25.849
1962 25.335 25.174 25.257 25.696 26.708 27.386 28.144 28.467 28.398 27.828 26.593 25.624
1963 25.103 24.899 25.371 25.914 26.646 27.481 27.953 28.341 28.277 27.652 26.733 25.661
1964 25.023 24.864 25.188 25.678 26.622 27.434 27.753 27.950 27.859 27.217 26.348 25.285
1965 24.478 24.373 24.636 25.399 26.180 26.973 27.499 27.912 27.954 27.550 26.709 25.768
1966 24.885 24.625 24.797 25.494 26.307 27.183 27.877 28.186 28.225 27.728 26.615 25.466
1967 24.794 24.639 24.872 25.375 26.345 27.023 27.564 27.914 27.973 27.529 26.550 25.478
1968 24.521 24.180 24.466 25.344 26.259 27.241 27.929 28.349 28.283 27.681 26.692 25.643
1969 24.838 24.668 25.022 26.111 27.064 27.970 28.415 28.547 28.431 27.852 26.705 25.604
1970 24.849 24.565 24.964 25.809 26.502 27.206 27.793 28.065 28.101 27.570 26.367 25.412
1971 24.756 24.505 24.660 25.258 26.161 26.984 27.564 27.832 27.747 27.238 26.304 25.473
1972 24.903 24.638 25.025 25.624 26.355 27.086 27.629 27.938 28.112 27.757 26.969 26.070
1973 25.217 24.837 25.237 25.591 26.594 27.422 27.919 28.030 27.989 27.440 26.454 25.131
1974 24.783 24.371 24.839 25.495 26.199 27.103 27.608 27.938 27.907 27.200 26.276 25.229
1975 24.622 24.564 24.867 25.532 26.407 27.202 27.545 27.947 27.777 27.236 26.326 25.045
1976 24.058 23.905 24.467 25.101 25.954 26.744 27.458 27.854 27.899 27.539 26.537 25.631
1977 24.768 24.636 25.078 25.422 26.202 27.195 27.869 28.085 28.096 27.613 26.797 25.758
1978 24.876 24.496 24.901 25.673 26.661 27.311 27.762 28.034 28.025 27.584 26.828 25.851
1979 24.920 24.658 24.853 25.461 26.285 27.295 27.820 28.137 28.090 27.640 26.608 25.577
1980 24.917 24.588 25.038 25.697 26.828 27.554 28.094 28.295 28.269 27.653 26.622 25.470
我的时间序列有一个周期性循环,我想看看它在另一个时间尺度(例如5或6年)中的变化,但我真的不知道如何去做。我应该使用数字滤波器。
答案 0 :(得分:0)
假设您拥有矩阵M
中的数据。
%Averaging period
k = 12*5;
%How often you want to have a lebel, you're going to need to play with this
timeUnits = 10*12;
startYear = 1948;
endYear = 1980;
startMonNum = 1;
endMonNum = 12;
%Get all the months and years
[year, mon] = meshgrid(startYear:endYear, 1:12);
%Convert them to a single column and put them in a nice format
dates = reshape(arrayfun(@(x, y) datestr(datenum(x,y,1),'mmm yyyy'), year,mon,'uni', 0), [], 1);
dates = dates(startMonNum:end-endMonNum+12);
%Change your data from a square matrix to a column
M = reshape((1:length(dates)), [], 12);
%Smooth
MPrime = smooth(reshape(M', [], 1), k);
plot(1:length(MPrime), MPrime)
%This is where you'll need to play around some
%Put strings at the bottom of the axis
set(gca, 'Xtick',1:timeUnits*floor(length(MPrime)/timeUnits))
set('XTickLabel',dates(1:timeUnits:end))