您好,欢迎访问三七文档
当前位置:首页 > 行业资料 > 酒店餐饮 > 时空分布预测模型程序
一、做散点图:clearall;x1=xlsread('18-24号时空分布.xls',1);x2=xlsread('18-24号时空分布.xls',2);x3=xlsread('18-24号时空分布.xls',3);x4=xlsread('18-24号时空分布.xls',4);x5=xlsread('18-24号时空分布.xls',5);x6=xlsread('18-24号时空分布.xls',6);x7=xlsread('18-24号时空分布.xls',7);form=1:64X=[x1(m),x2(m),x3(m),x4(m),x5(m),x6(m),x7(m)];%a-a交通量一周数据序列mplot(X,'k-')%holdonfigureendxlabel('时间/天')ylabel('各小区之间交通量/辆')123456701234567x104时间/天各小区之间交通量/辆二:用灰色数列预测:G(1,1)模型预测:由于时空分布数据不呈现出一定的规律,比较适合使用灰色预测模型进行预测。clearall;x1=xlsread('18-24号时空分布.xls',1);x2=xlsread('18-24号时空分布.xls',2);x3=xlsread('18-24号时空分布.xls',3);x4=xlsread('18-24号时空分布.xls',4);x5=xlsread('18-24号时空分布.xls',5);x6=xlsread('18-24号时空分布.xls',6);x7=xlsread('18-24号时空分布.xls',7);form=1:64mX=[x1(m),x2(m),x3(m),x4(m),x5(m),x6(m),x7(m)];%a-a交通量一周数据序列%对X数据序列作一次累加生成X1X1=zeros(1,7);X1(1)=X(1);fori=2:7X1(i)=X1(i-1)+X(i);endB=zeros(6,2);forj=1:6B(j,1)=-0.5*(X1(j+1)+X1(j));endB=[B(:,1),ones(6,1)];Yn=[X(2),X(3),X(4),X(5),X(6),X(7)];a=inv((B'*B))*B'*Yn';%最小二乘法求解系数a%X_k+1=(X(0)-a(2)/a(1))*e^(-a(1)*k+a(2)/a(1);X_y=zeros(1,9);k=1:8;X_1=(X(1)-a(2)/a(1))*exp(-a(1)*k)+a(2)/a(1)%建立GM(1,1)模型X_1=[X1(1),X_1];%预测fork=1:8X_y(k+1)=X_1(k+1)-X_1(k);endX_y(1)=X_1(1)plot(X,'k-')holdonplot(X_y,'r-')figuree=(X-X_y(1:7))./X%真值与预测值得绝对误差delt_e=sum(e)/7%平均相对误差delt_e0.01则精度为一级ss=0;ss1=0;fork=2:6ss=ss+(X(k)-X(1));ss1=ss1+(X_y(k)-X_y(1));ends=abs(ss+0.5*(X(7)-X(1)));s1=abs(ss1+0.5*(X_y(7)-X_y(1)));delt_s=abs(ss+0.5*(X(7)-X(1))-ss1-0.5*(X_y(7)-X_y(1)))w=(1+s+s1)/(1+s+s1+delt_s)%w为关联度,w0.90关联度为一级。C=(mean((e-delt_e).^2)/mean((X-mean(X)).^2))^0.5%均方差比C0.35为一级endm=1X_1=1.0e+004*Columns1through61.39312.04092.70203.37674.06534.7681Columns7through85.48546.2175X_y=1.0e+003*Columns1through67.58506.34656.47736.61086.74716.8861Columns7through97.02817.17297.3208e=Columns1through600.1085-0.1189-0.09850.05000.0066Column70.0155delt_e=-0.0052delt_s=52.2662w=0.9950C=1.2183e-004m=2X_1=1.0e+004*Columns1through60.32700.49210.65200.80710.95741.1031Columns7through81.24441.3813X_y=1.0e+003*Columns1through61.56801.70241.65021.59971.55071.5032Columns7through91.45721.41251.3693e=Columns1through600.0393-0.10460.01370.0720-0.0171Column7-0.0211delt_e=-0.0025delt_s=15.6719w=0.9383C=4.5867e-004m=3X_1=1.0e+003*Columns1through60.33600.50280.66010.80840.94811.0799Columns7through81.20421.3213X_y=Columns1through6159.0000176.9692166.8351157.2813148.2746139.7837Columns7through9131.7790124.2327117.1185e=Columns1through60-0.21210.05740.11140.2435-0.1649Column7-0.2671delt_e=-0.0331delt_s=12.9666w=0.6753C=0.0057m=4X_1=1.0e+003*Columns1through60.83971.26101.64882.00592.33462.6372Columns7through82.91583.1722X_y=Columns1through6382.0000457.6691421.3207387.8591357.0551328.6975Columns7through9302.5922278.5601256.4367e=Columns1through600.0324-0.17690.08520.10510.0070Column7-0.1207delt_e=-0.0097delt_s=16.1024w=0.5871C=0.0016m=5X_1=Columns1through689.5086127.2504163.3044197.7461230.6475262.0776Columns7through8292.1021320.7839X_y=Columns1through650.000039.508637.741836.054034.441732.9014Columns7through931.430130.024528.6818e=Columns1through60-0.12880.0795-0.03010.11690.1564Column7-0.3665delt_e=-0.0247delt_s=4.1375w=0.9739C=0.0220m=6X_1=1.0e+003*Columns1through60.52180.78231.03091.26821.49471.7109Columns7through81.91732.1143X_y=Columns1through6249.0000272.8348260.4336248.5962237.2968226.5110Columns7through9216.2154206.3878197.0069e=Columns1through600.0393-0.0897-0.04450.08730.0792Column7-0.1088delt_e=-0.0053delt_s=10.7199w=0.6695C=0.0029m=7X_1=Columns1through626.448439.725251.925563.136473.438382.9048Columns7through891.603799.5972X_y=Columns1through612.000014.448413.276812.200211.210910.3019Columns7through99.46658.69897.9935e=Columns1through600.0970-0.0213-0.52500.1992-0.0302Column70.0533delt_e=-0.0324delt_s=0.1715w=0.8723C=0.0847m=8X_1=Columns1through61.06431.79822.30432.65332.89403.0599Columns7through83.17443.2533X_y=Columns1through601.06430.73390.50610.34900.2407Columns7through90.16590.11440.0789e=Columns1through6NaN-0.06430.2661-Inf0.6510-InfColumn7-Infdelt_e=NaNdelt_s=0.0230w=0.9967C=NaNm=9X_1=1.0e+004*Columns1through60.33360.49710.65310.80210.94421.0799Columns7through81.20941.3330X_y=1.0e+003*Columns1through61.62301.71301.63491.56041.48931.4215Columns7through91.35671.29491.2359e=Columns1through600.0289-0.0707-0.00930.06860.0080Column7-0.0373delt_e=-0.0017delt_s=25.4881w=0.9703C=3.0935e-004m=10X_1=1.0e+005*Columns1through60.31810.47930.63640.78940.93861.0840Columns7through81.22571.3638X_y=1.0e+004*Columns1through61.52761.65371.61171.57071.53081.4919Columns7through91.45401.41711.3811e=Columns1through600.0527-0.1223-0.00330.06500.0314Column7-0.0473delt_e=-0.0034delt_s=332.2149w=0.9235C=5.4077e-005m=11X_1=1.0e+003*Columns1through61.91992.86893.74004.53975.27375.9474Columns7through86.56587.1335X_y=1.0e+003*Columns1through60.88601.03390.94900.87110.79960.7340Columns7through90.67370.61840.5677e=Columns1through600.0427-0.17020.01900.15740.0174Column7-0.1497delt_e=-0.0119delt_s=43.4815w=0.8541C=7.2615e-004m=12X_1=1.0e+004*Columns1through60.43830.65140.84801.02931.19651.3507Columns7through81.49291.6240X_y
本文标题:时空分布预测模型程序
链接地址:https://www.777doc.com/doc-4860622 .html