📄 ardemo.m
字号:
function ardemo
% ar预测
% Parameter:
nseq = [105851 107507 109300 111026 112704 114333 115823 117171 118517 ...
119850 121121 122389 123626 124761 125786 126743 127627 128453 129227 129988 130756 131448 132129];
% Base the Input Predict Method to solve the nseq
nseq = nseq';
nseqdata = iddata(nseq(1:15));
m = ar(nseqdata,3,'burg');
yfilter = predict(m, nseq(16:23));
% Plot the orignal Graphic
x = 1:1:8; % 33个标本数据
y = nseq(16:23);
yar = yfilter{1};
plot(x,y, '-b*',x,yar, '--rs','LineWidth',2,...
'MarkerEdgeColor','k',...
'MarkerFaceColor','g',...
'MarkerSize',2);
mse = MSE(nseq(16:23), yar);
avmae = mae(nseq(16:23), yar);
rerr = releaterror(nseq(16:23), yar);
disp( sprintf('The mean square error is: %f', mse ));
disp( sprintf('The avarage real error is: %f', avmae ));
disp( sprintf('平均相对误差 is %f', rerr));
title('全社会客货运输量AR模型预测', 'FontSize', 10);
xlabel('月份', 'FontSize', 10);
ylabel('铁路客户量(亿)', 'FontSize', 10);
grid on
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -