⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 regressdemo.m

📁 时间序列预测算法。支持5种常见的算法 移动平均 非线性回归 指数平滑等
💻 M
字号:
function regressdemo
% 非线性拟合预测
% 双曲线

% 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];
nx = [1: 23];

% Base the Input Predict Method to solve the nseq
coef = polyfit(nx,nseq,3);

yfilter = polyval(coef,nx); 

% Plot the orignal Graphic
x = 1:1:23;    % 33个标本数据
y = nseq;
plot(x,y, '--bs',x,yfilter, '--rs','LineWidth',2,...
                'MarkerEdgeColor','k',...
                'MarkerFaceColor','g',...
                'MarkerSize',2);

mse = MSE(nseq(16:23), yfilter(16:23));
avmae = mae(nseq(16:23), yfilter(16:23));
rerr = releaterror(nseq(16:23), yfilter(16:23));
disp( sprintf('The mean square error is: %f', mse ));
disp( sprintf('The  avarage real error is: %f', avmae ));
disp( sprintf('平均相对误差 is %f', rerr));
title('全社会客货运输量非线性回归模型预测', 'FontSize', 10);
xlabel('月份', 'FontSize', 10);
ylabel('铁路客户量(亿)', 'FontSize', 10);
grid on

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -