欢迎光临散文网 会员登陆 & 注册

北太天元软件用灰度模型GM(1,1)预测春运人数

2023-01-26 23:52 作者:卢朓  | 我要投稿

%北太天元软件用灰度模型GM(1,1)做春运人数预测

clc;clear;clf; close all

%年 总人数(亿), 铁路运输总人数(亿), 公路运输总人数(亿)

tp = [

   2015 28.07 3.0 23.0

   2016 29.1  3.26 24.95

   2017 29.78 3.57 24.75

   2018 29.7  3.82 24.7

   2019 29.8  4.07 24.6

];

data=tp(:,2:4);


% 累加数据

data1=cumsum(data,1);

%求解系数

%进行预测

X=tp(:,1);;%已知年份数据

X_p = (2020:2024); %预测年份

X_p = X_p';

T=[X;X_p];

X_sta=X(1);%最开始参考数据

data_T1 = zeros(size(T,1), size(data,2));

for j=1:size(data,2)

   B=zeros(size(data,1)-1,2);

   for i=1:size(data,1)-1

       B(i,1)=-1/2*(data1(i,j)+data1(i+1,j));

       B(i,2)=1;

   end

   Y=data(2:end,j);

   a_u=inv(B'*B)*B'*Y;

   a=a_u(1); u=a_u(2);

   data_p=(data1(1,j)-u/a).*exp(-a.*(T-X_sta))+u/a;%累加数据

   data_T1(1,j)=data_p(1);

   for n=2:length(data_p)

       data_T1(n,j)=data_p(n)-data_p(n-1);

   end

end


title_str={'春运总人数','春运铁路人数','春运公路人数'};

figure(1)


for j=1:3

 subplot(2,2,j)

 plot(T,data_T1(:,j),'-or','LineWidth',3);

 legend('预测人数','Location','NorthWest');

 title(title_str{j})

end


 subplot(2,2,4)

 plot(T,data_T1(:,1)-data_T1(:,2)-data_T1(:,3),'-or','LineWidth',3);

 legend('预测人数','Location','NorthWest');

 title("铁路和公路之外的春运人数")


figure(2)

 plot(T,data_T1(:,2),'-or','LineWidth',3);

 legend('预测人数','Location','NorthWest');

 title(title_str{2})

北太天元软件用灰度模型GM(1,1)预测春运人数的评论 (共 条)

分享到微博请遵守国家法律