数学建模b题完整程序.doc

上传人:laozhun 文档编号:2892253 上传时间:2023-03-01 格式:DOC 页数:14 大小:35.50KB
返回 下载 相关 举报
数学建模b题完整程序.doc_第1页
第1页 / 共14页
数学建模b题完整程序.doc_第2页
第2页 / 共14页
数学建模b题完整程序.doc_第3页
第3页 / 共14页
数学建模b题完整程序.doc_第4页
第4页 / 共14页
数学建模b题完整程序.doc_第5页
第5页 / 共14页
点击查看更多>>
资源描述

《数学建模b题完整程序.doc》由会员分享,可在线阅读,更多相关《数学建模b题完整程序.doc(14页珍藏版)》请在三一办公上搜索。

1、num,data=xlsread(F:建模cumcm2011Problems中文版Bcumcm2011B附件2_全市六区交通网路和平台设置的数据表.xlsx)x=num(:,2)y=num(:,3)plot(x,y,r.)num1,data1=xlsread(F:建模cumcm2011Problems中文版Bcumcm2011B附件2_全市六区交通网路和平台设置的数据表.xlsx)num2,data2=xlsread(F:建模cumcm2011Problems中文版Bcumcm2011B附件2_全市六区交通网路和平台设置的数据表.xlsx,全市交通路口的路线)xyznpathnumz=data

2、:,4dataz=data:,4data:,4datedataz=data(:,4)hold onfor i=1:length(x)if(strcmp(z(1),A)plot(x(i),y(i),.)endendhold onfor i=1:length(x)if(strcmp(z(1),A)plot(x(i),y(i),.)endendhold onfor i=1:length(x)if(strcmp(z(i),A)plot(x(i),y(i),.)endendz=z(2:end)hold onfor i=1:length(x)if(strcmp(z(i),A)plot(x(i),y(i),

3、.)endendhold onfor i=1:length(x)if(strcmp(z(i),A)plot(x(i),y(i),.)endendnum1,data1=xlsread(C:UsersyaokaiqianDesktopcumcm2011Problems中文版Bcumcm2011B附件2_全市六区交通网路和平台设置的数据表.xls)num2,data2=xlsread(C:UsersyaokaiqianDesktopcumcm2011Problems中文版Bcumcm2011B附件2_全市六区交通网路和平台设置的数据表.xls,全市交通路口的路线)m=num1(:,6)m=num(:

4、,6)num1,data1=xlsread(C:UsersyaokaiqianDesktopcumcm2011Problems中文版Bcumcm2011B附件2_全市六区交通网路和平台设置的数据表.xls)m=num1(:,6)n=num1(:,7)hold onfor i=1:length(x)if(strcmp(z(i),A)plot(x(i),y(i),.);if(m(i)=1)plot(x(i),y(i),ro);endif(n(i)=1)plot(x(i),y(i),r*);endendendline1=num2(:,1)line2=num2(:,2)hold onfor i=1:l

5、ength(x)if(strcmp(z(i),A)plot(x(i),y(i),.);if(m(i)=1)plot(x(i),y(i),ro);endif(n(i)=1)plot(x(i),y(i),r*);endendendfor i=1:length(line1)if(line1(i)=92)if(line2(i)=92)line(x(line1(i),x(line2(i),y(line1(i),y(line2(i);endendendhold onfor i=1:length(x)if(strcmp(z(i),A)plot(x(i),y(i),.);if(m(i)=1)plot(x(i)

6、,y(i),ro);endif(n(i)=1)plot(x(i),y(i),r*);endtext(x(i),y(i),num2str(i);endend %差一个点就OK了for i=1:length(line1)if(line1(i)=92)if(line2(i)=92)line(x(line1(i),x(line2(i),y(line1(i),y(line2(i);endendend -hold onfor i=1:length(x)plot(x(i),y(i),.);if(m(i)=1)plot(x(i),y(i),ro);endif(n(i)=1)plot(x(i),y(i),r*)

7、;endendfor i=1:length(line1)line(x(line1(i),x(line2(i),y(line1(i),y(line2(i);endendhold onfor i=1:length(x)plot(x(i),y(i),.);if(m(i)=1)plot(x(i),y(i),ro);endif(n(i)=1)plot(x(i),y(i),r*);endendfor i=1:length(line1)line(x(line1(i),x(line2(i),y(line1(i),y(line2(i);endhold onfor i=1:length(x)plot(x(i),y

8、(i),.);if(m(i)=1)plot(x(i),y(i),ro);endif(n(i)=1)plot(x(i),y(i),r*);endendfor i=1:length(line1)line(x(line1(i),x(line2(i),y(line1(i),y(line2(i);endhold onfor i=1:length(x)if(strcmp(z(i),A)plot(x(i),y(i),.);if(m(i)=1)plot(x(i),y(i),ro);endif(n(i)=1)plot(x(i),y(i),r*);endtext(x(i),y(i),num2str(i);ende

9、ndfor i=1:length(line1)if(line1(i)=92)if(line2(i)=92)line(x(line1(i),x(line2(i),y(line1(i),y(line2(i);endendendhold onfor i=1:length(x)if(strcmp(z(i),A)plot(x(i),y(i),.);if(m(i)=1)plot(x(i),y(i),ro);endif(n(i)=1)plot(x(i),y(i),r*);endtext(x(i),y(i),num2str(i);endendfor i=1:length(line1)if(line1(i)=9

10、2)if(line2(i)=92)line(x(line1(i),x(line2(i),y(line1(i),y(line2(i);endendendhold onfor i=1:length(x)if(strcmp(z(i),A)plot(x(i),y(i),.);if(m(i)=1)plot(x(i),y(i),ro);endif(n(i)=1)plot(x(i),y(i),r*);endtext(x(i),y(i),num2str(i);endendfor i=1:length(line1)if(line1(i)=92)if(line2(i)=92)line(x(line1(i),x(l

11、ine2(i),y(line1(i),y(line2(i);endendendfor i=1:length(line1)line(x(line1(i),x(line2(i),y(line1(i),y(line2(i);endhold onfor i=1:length(x)plot(x(i),y(i),.);if(m(i)=1)plot(x(i),y(i),ro);endif(n(i)=1)plot(x(i),y(i),r*);endtext(x(i),y(i),num2str(i);endendfor i=1:length(line1)line(x(line1(i),x(line2(i),y(

12、line1(i),y(line2(i);end -全图hold onfor i=1:length(x)plot(x(i),y(i),.);if(m(i)=1)plot(x(i),y(i),ro);endif(n(i)=1)plot(x(i),y(i),r*);endendfor i=1:length(line1)line(x(line1(i),x(line2(i),y(line1(i),y(line2(i);endtmp=cat(2)tmp1=1;for i=1:length(line1)if(line1(i)=92)if(line2(i)=92)tmp(tmp1,1)=line1(i)tmp

13、(tmp1,2)=line2(i)endendendxlswrite(tmp.xls,tmp)hold onfor i=1:length(x)if(strcmp(z(i),A)plot(x(i),y(i),.);if(m(i)=1)plot(x(i),y(i),ro);endif(n(i)=1)plot(x(i),y(i),r*);endtext(x(i),y(i),num2str(i);endend-for i=1:length(line1)if(line1(i)=92)if(line2(i)=92) 连线line(x(line1(i),x(line2(i),y(line1(i),y(lin

14、e2(i);endendend-hold onfor i=1:length(x)plot(x(i),y(i),.);if(m(i)=1)plot(x(i),y(i),ro); 描点 endif(n(i)=1)plot(x(i),y(i),r*);endend-for i=1:length(line1)line(x(line1(i),x(line2(i),y(line1(i),y(line2(i);endtmp=cat(2)tmp1=1;for i=1:length(line1)if(line1(i)=92)if(line2(i)=92)tmp(tmp1,1)=line1(i)tmp(tmp1,

15、2)=line2(i)endendendxlswrite(tmp.xls,tmp)clc;clearShapeX = 413403383.5381339335317334.5333282247219225280290337415432418444251234225212227256250.5243246314315326327328336331371388.5411419411394342325315342345348.5351348370371354363357351369335381391392395398401405410408415418422418.5405.540540941742

16、0424438438.5434438440447448444.5441440.5;ShapeY = 359343351377.5376383362353.5342325301316270292335328335371374394277271265290300301306328337367351355350342.5339334335330333330.5327.5344343346342348372374372382380.5377369363353374382.5387382388395381375366361362359360355350351347354356364.5368370364

17、370372368373376385392381383385381.5;N=length(ShapeX);for i=1:Nfor j=1:NDistance(i,j)=sqrt(ShapeX(i)-ShapeX(j)2+(ShapeY(i)-ShapeY(j)2);endendDistanceA=zeros(N);Max_Value=zeros(N);for k=1:Nmax_line,column=max(Distance(k,:);A(k,column)=max_line;endMax_Value(k,column)=max(max(A)I,J=find(Max_Value)point_

18、start=ShapeX(I) ShapeY(I)point_end=ShapeX(J) ShapeY(J)hold onfor i=1:length(x)if(strcmp(z(i),A)plot(x(i),y(i),.);if(m(i)=1)plot(x(i),y(i),ro);endif(n(i)=1)plot(x(i),y(i),r*);endtext(x(i),y(i),num2str(i);endendfor i=1:length(line1)if(line1(i)=92)if(line2(i)=92)line(x(line1(i),x(line2(i),y(line1(i),y(

19、line2(i);endendendhold onfor i=1:length(x)if(strcmp(z(i),A)plot(x(i),y(i),.);if(m(i)=1)plot(x(i),y(i),ro);endif(n(i)=1)plot(x(i),y(i),r*);endtext(x(i),y(i),num2str(i);endendfor i=1:length(line1)if(line1(i)=92)if(line2(i)=92)line(x(line1(i),x(line2(i),y(line1(i),y(line2(i);endendendx=x=num(:,2)num2,d

20、ata2=xlsread(C:UsersyaokaiqianDesktopcumcm2011Problems中文版Bcumcm2011B附件2_全市六区交通网路和平台设置的数据表.xls)hold onfor i=1:length(x)if(strcmp(z(i),A)plot(x(i),y(i),.);if(m(i)=1)plot(x(i),y(i),ro);endif(n(i)=1)plot(x(i),y(i),r*);endtext(x(i),y(i),num2str(i);endendfor i=1:length(line1)if(line1(i)=92)if(line2(i)=92)

21、line(x(line1(i),x(line2(i),y(line1(i),y(line2(i);endendendhold onfor i=1:length(x)plot(x(i),y(i),.);if(m(i)=1)plot(x(i),y(i),ro);endif(n(i)=1)plot(x(i),y(i),r*);endendfor i=1:length(line1)line(x(line1(i),x(line2(i),y(line1(i),y(line2(i);endhold onfor i=1:length(x)if(strcmp(z(i),A)plot(x(i),y(i),.);if(m(i)=1)plot(x(i),y(i),ro);endif(n(i)=1)plot(x(i),y(i),r*);endtext(x(i),y(i),num2str(i);endendfor i=1:length(line1)if(line1(i)=92)if(line2(i)=92)line(x(line1(i),x(line2(i),y(line1(i),y(line2(i);endendend

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 建筑/施工/环境 > 项目建议


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号