2011 数学建模竞赛 c 题程序
x=[566 632 745 755 769 789 985 1110 1313 1428 1782 1920 2150 2292 2601 3149 4338 5145
5809 6241 6854 7656 8772 10007 11374 12567 14332 16614 19228 22844 26404 29688 32074 ];
>> y=diff(x);
>> plot(y)
>> a=lpc(y,3)
a =
>> estx=filter([0-a(2:end)],1,y);
>> e=y-estx;
>> subplot(122);
>> plot(lags,acs)
2011 数学建模竞赛 c 题
(1) 数据初步处理:对一般的时间序列而
言为得到较为平稳的序列都会对原
来的序列进行取对和差分处理并对
新的数列进行白噪声检验
0 10 20 30 40
-500
0
500
1000
1500
2000
2500
3000
3500
4000
-40 -20 0 20 40
0
1
预 测 误 差 的 自 相 关 函 数
cdata=[566,632,745,755,769,789,985,1110,13
13,1428,1782,1920,2150,2292,2601,3149,433
8,5145,5809,6241,6854,7656,8772,10007,113
74,12567,14332,16614,19228,22844,26404,29
688,32074];
>> x=log(cdata);
>> plot(x)
>> x1=diff(x);
>> subplot(221)
>> plot(x)
>> subplot(222)
>> plot(x1)
a=ar(x2,2)
0 10 20 30 40
0
1
2
3
x 10
4
0 10 20 30 40
6
7
8
9
10
11
0 10 20 30 40
0
0 10 20 30 40
0
0 5 10 15 20
0
1
Lag
S
a
m
p
le
A
u
to
c
o
rr
e
la
ti
o
n
Sample Autocorrelation Function (ACF)
0 5 10 15 20
-1
0
1
Lag
S
a
m
p
le
P
a
rt
ia
l
A
u
to
c
o
rr
e
la
ti
o
n
s
Sample Partial Autocorrelation Function
Discrete-time IDPOLY model: A(q)y(t) = e(t)
A(q) = 1 - q^-1 - q^-2
y2(1)=;
>> y2(2)=;
>> for i=3:32
y2(i)=*y2(i-1)+*y2(i-2);
end
>> plot(x2(1:32))
>> hold on
>> plot(y2)
(2) 真实值与可能值比较
、
0 5 10 15 20 25 30 35
0
1
2
3
x 10
4
0 10 20 30 40 50 60
-5
0
5
10
15
20
x 10
4 真 实 值 估 计 值
程序如下
0 5 10 15 20
5
6
7
8
9
10
11
12
-20 -10 0 10 20
0
1
程 序 如 下
x=[566,632,745,755,769,789,985,1110,1313,1
428,1782,1920,2150,2292,2601,3149,4338,51
45,5809,6241,6854,7656,8772,10007,11374,1
2567,14332,16614,19228,22844,26404,29688,
32074];
>> y=log(x);
x1=diff(y);
a =
-40 -30 -20 -10 0 10 20 30 40
0
1
预 测 误 差 自 相 关 函 数
>> estx=filter([0-a(2:end)],1,x1);
e=x1-estx;
>> [acs,lags]=xcorr(e,'coeff');
>> figure
>> plot(x1,'-*')
>> hold on
>> plot(estx,'-r*')
0 5 10 15 20 25 30 35
6
7
8
9
10