0 126.3698 72.2658 57.9688 9.2142
Columns 6 through 10
-46.8496 -97.1716 -103.8091 8.0596 -6.8780
Columns 11 through 14
35.9154 96.8102 25.9906 23.4334
xiangduiwucha =
Columns 1 through 5
0 0.1976 0.1122 0.0834 0.0128
Columns 6 through 10
0.0630 0.1239 0.1182 0.0073 0.0057
Columns 11 through 14
0.0258 0.0601 0.0152 0.0123
jibipiancha =
Columns 1 through 5
-0.0960 -0.1065 -0.0326 -0.0771 -0.0769
Columns 6 through 10
-0.0575 0.0050 0.1122 -0.0132 0.0312
Columns 11 through 13
0.0352 -0.0479 -0.0030
旅游收入相关度 clc,clear
load x.txt %把原始数据存放在纯文本文件x.txt 中,其中把数据的\替换替换成.
19
for i=1:6
x(i,:)=x(i,:)/x(i,1); %标准化数据 end for i=7:8
x(i,:)=x(i,1)./x(i,:); %标准化数据 end data=x;
n=size(data,2); %求矩阵的列数,即观测时刻的个数 ck=data(1,:); %提出参考数列 bj=data(2:end,:); %提出比较数列 m2=size(bj,1); %求比较数列的个数 for j=1:m2 t(j,:)=bj(j,:)-ck; end
mn=min(min(abs(t'))); %求最小差 mx=max(max(abs(t'))); %求最大差 rho=0.5; %分辨系数设置
ksi=(mn+rho*mx)./(abs(t)+rho*mx); %求关联系数 r=sum(ksi')/n %求关联度
[rs,rind]=sort(r,'descend') %对关联度进行排序
结果: r =
Columns 1 through 5
0.7095 0.8274 0.8619 0.8059 0.8182
Columns 6 through 7
0.6853 0.6256 rs =
Columns 1 through 5
0.8619 0.8274 0.8182 0.8059 0.7095
Columns 6 through 7
0.6853 0.6256
20
rind =
3 2 5 4 1 6 7
旅游人数相关度:
r =
Columns 1 through 5
0.7035 0.8227 0.8583 0.8015 0.8135
Columns 6 through 7
0.6790 0.6610 rs =
Columns 1 through 5
0.8583 0.8227 0.8135 0.8015 0.7035
Columns 6 through 7
0.6790 0.6610
rind =
3 2 5 4 1 6 7
三、BP神经网络模型 旅游总收入程序:
clc; clear all; close all;
m=[59810.52921 121121 4252 2355 218.71 115.7 6.2389 1375.7; 70142.49165 122389 4986 2789 256.2 118.58 6.49 1638.38;
21
78060.835 123626 6222 3002 328.06 122.64 6.6 2112.7; 83024.27977 124761 7326 3159 345 127.85 6.64 2391.18; 88479.15475 125786 8993 3346 394 135.17 6.47 2831.92; 98000.45431 126743 10532 3632 426.6 104.27 6.87 3175.54; 108068.2206 127627 11552 3887 449.5 169.8 7.0058 3522.37; 119095.6893 128453 13361 4144 441.8 176.52 7.19 3878.36; 135173.9761 129227 14927 4475 395.7 180.98 7.3 3442.27; 159586.7479 129988 16245 5032 427.5 187.07 7.44 4710.71; 185808.559 130756 17957 5573 436.1 334.52 7.544 5285.86; 217522.6698 131448 18943 6263 446.9 345.7 7.70838 6229.7; 267763.6588 132129 20110 7255 482.6 358.3715 7.79659 7770.6; 316228.8248 132802 21224 8349 511.03 373.02 7.968728 8749.295918; 343464.6903 133474 21631 9098 535.4 386.0823 8.551789 10183.7;];
x1=m(:,1);
x11=x1'./343464.6903; x12=x11(:,1:11); x13=x11(:,12:15); x2=m(:,2); x22=x2'./133474; x23=x22(:,1:11); x21=x22(:,12:15); x3=m(:,3); x33=x3'./21631; x31=x33(:,1:11); x32=x33(:,12:15); x4=m(:,4); x44=x4'./9098; x41=x44(:,1:11); x42=x44(:,12:15); x5=m(:,5); x55=x5'./535.4; x52=x55(:,1:11); x51=x55(:,12:15); x6=m(:,6); x66=x6'./386.0823; x62=x66(:,1:11); x61=x66(:,12:15); x7=m(:,7); x77=x7'./8.552; x72=x77(:,1:11); x71=x77(:,12:15); y1=m(1:11,8);
22
y11=y1'./10183.7;
p=[x12;x23;x31;x41;x52;x62;x72];
net=newff(minmax(p),[7,15,1],{'tansig','tansig','purelin'},'trainlm') net.trainparam.epochs=2000; net.trainparam.goal=0.00001;
net=train(net,p,y11);
y0=sim(net,p); E=y0-y11; M=sse(E) N=mse(E)
plot(p,y11,'or',p,y0,'*b')
legend('原始曲线','神经网络拟合曲线') p0=[x13;x21;x32;x42;x51;x61;x71];
Y2=sim(net,p0) y22=Y2.*10183.7 结果:
N =
4.6313e-007 Y2 =
0.6725 0.8896 0.8739 0.8849 y22 =
1.0e+003 *
6.8482 9.0597 8.8999 9.0120
23