2011全国数学建模大赛A题相关matlab程序..docVIP

  • 9
  • 0
  • 约1.79千字
  • 约 5页
  • 2017-02-01 发布于重庆
  • 举报

2011全国数学建模大赛A题相关matlab程序..doc

2011全国数学建模大赛A题相关matlab程序.

2011全国数学建模大赛A题相关matlab程序 (2011-09-16 16:42:56) 这是我在今年全国大学生数学建模大赛中解答A题的相关MATLAB程序(供大家参考),同时晒两张相关图片: %绘单个元素空间分布图程序 clear all; load shuju.txt a=shuju(1:end,8);% b=a/69;% load data.txt x=data(1:end,1); y=data(1:end,2); z=data(1:end,3); scatter3(x,y,z,50,b,filled) xlabel(X) ylabel(Y) zlabel(海拔) %算各区污染平均指数程序 clear all; load shuju.txt for i=1:8 a=shuju(1:end,i); %i随数据文本列数决定 p=[3.6 130 31 13.2 35 12.3 31 69] b(:,i)=a/p(i); %i随数据文本列数决定 end load data.txt x=data(1:end,4); m=1; sum=0; for i=1:319 if x(i)==5 cb(m)=b(i,8); sum=sum+cb(m); m=m+1; end end av=sum/(m-1) %层次分析法一致性检验程序 clear close all clc tic disp(please input Matrix A) A=input(A=\n); %A矩阵为需要分析的n阶方阵! [n,n]=size(A); x=ones(n,100); y=ones(n,100); m=zeros(1,100); m(1)=max(x(:,1)); y(:,1)=x(:,1); x(:,2)=A*y(:,1); m(2)=max(x(:,2)); y(:,2)=x(:,2)/m(1); p=0.0001; i=2; k=abs(m(2)-m(1)); while kp; i=i+1; x(:,i)=A*y(:,i-1); m(i)=max(x(:,i)); y(:,i)=x(:,i)/m(i); k=abs(m(i)-m(i-1)); end a=sum(y(:,i)); w=y(:,i)/a; t=m(i); disp(权重向量w=) disp(w) %fprintf(权重向量w=%f\n,w); fprintf(最大特征根t=\n %f\n,t); %以下为该方阵的一致性检验! CI=(t-n)/(n-1); RI=[0 0 .58 .90 1.12 1.24 1.32 1.41 1.45 1.49 1.51]; CR=CI/RI(n); if CR0.1; disp(CI=) disp(CI) disp(RI=) disp(RI(n)) disp(CR=) disp(CR) fprintf(所以\n CR0.1\n\n); disp(因此该方阵可以通过一致性检验!!!) else disp(因此该方阵不可以通过一致性检验!!!) end %总权重计算程序 clear all; clc load chu.txt a=chu(1,:);% b=chu(2,:);% c=chu(3,:);% d=chu(4,:);% e=chu(5,:);% k=chu(5,:); sum=0; for i=1:4 %根据总矩阵列数决定4所在位置的数据 l(i)=a(i)*b(i); sum=sum+l(i); end sum1=0; for i=1:4 l(i)=a(i)*c(i); sum1=sum1+l(i); end sum2=0; for i=1:4 l(i)=a(i)*d(i); sum2=sum+l(i); end sum3=0; for i=1:4 l(i)=a(i)*e(i); sum3=sum+l(i); end sum4=0; for i=1:4%3这一位的数由阵列列数决定 l(i)=a(i)*k(i); sum4=sum+l(i); end sum sum1 sum2 sum3 sum4

文档评论(0)

1亿VIP精品文档

相关文档