主要问题包括:
1、变量x未定义。
2、函数MUSIC里面:
S=[S(257:512)S(1:256)]应为
S=[S(257:512) S(1:256)]另外,clearR未定义,不知道干什么用的,可以直接删掉。
3、函数ARMA里面,调用的Burg未定义。
满意请采纳z=[DXzeros(12,1)]
z=iddata(z)
test=[]
for p=1:12
for q=1:12
m=armax(z(1:200),[p q])
AIC=aic(m)
test=[testp q AIC]
end
end
for k=1:size(test,1)
if test(k,3)==min(test(:,3))
p_test=test(k,1)
q_test=test(k,2)
break
end
end
%拟合
m1=armax(z(1:200),[p_test q_test])
figure(5)
e = resid(m1,z)
plot(e)
set(gca,'Xlim',[0 ls])
figure(6)
subplot(2,1,1)
autocorr(e.outputdata)
subplot(2,1,2)
parcorr(e.outputdata)
set(gca,'Xlim',[0 ls])
%预测过程
pr=predict(m1,z,12)
po=pr.outputdata
figure(7)
plot(po,'r')
hold on
plot(y,'b')
set(gca,'Xlim',[0 ls])
功能:估计ARMA时间序列模型参数
格式:
m = armax(data, orders)
m = armax(data, 'na', na, 'nb', nb, 'nc', nc, 'nk', nk)
m = armax(data, orders, 'Property1', Value1,..., 'PropertyN', ValueN)
摘自博客
例如:A=[1,2,3,4] xcorr(A)=[4,10,20,30,20,10,4]
注:xcorr.length=A.lenth*2-1 ,且为对称
autocorr(Series,nLags,M,nSTDs) //计算并绘制时间序列的自相关函数
autocorr是对序列 减去均值后做的自相关 ,最后又进行了 归一化 。而且由于自相关本身是偶函数,autocorr只是取了以中点n为起始的后面n个序列。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)