x=num(:,2)
y=num(:,3)
plot(x,y,'r.')
[num1,data1]=xlsread('F:\\建模\\cumcm2011Problems中文版\\B\\cumcm2011B附件2_全市六区交通网路和平台设置的数据表.xlsx')
[num2,data2]=xlsread('F:\\建模\\cumcm2011Problems中文版\\B\\cumcm2011B附件2_全市六区交通网路和平台设置的数据表.xlsx','全市交通路口的路线')
x
y
z
n
path
num
z=data[:,4]
data
z=data[:,4]
data[:,4]
date
data
z=data(:,4)
hold on
for i=1:length(x)
if(strcmp(z(1),'A'))
plot(x(i),y(i),'.')
end
end
hold on
for i=1:length(x)
if(strcmp(z(1),'A'))
plot(x(i),y(i),'.')
end
end
hold on
for i=1:length(x)
if(strcmp(z(i),'A'))
plot(x(i),y(i),'.')
end
end
z=z(2:end)
hold on
for i=1:length(x)
if(strcmp(z(i),'A'))
plot(x(i),y(i),'.')
end
end
hold on
for i=1:length(x)
if(strcmp(z(i),'A'))
plot(x(i),y(i),'.')
end
end
[num1,data1]=xlsread('C:\\Users\\yaokaiqian\\Desktop\\cumcm2011Problems中文版\\B\\cumcm2011B附件2_全市六区交通网路和平台设置的数据表.xls')
[num2,data2]=xlsread('C:\\Users\\yaokaiqian\\Desktop\\cumcm2011Problems中文版\\B\\cumcm2011B附件2_全市六区交通网路和平台设置的数据表.xls','全市交通路口的路线')
m=num1(:,6)
m=num(:,6)
[num1,data1]=xlsread('C:\\Users\\yaokaiqian\\Desktop\\cumcm2011Problems中文版\\B\\cumcm2011B附件2_全市六区交通网路和平台设置的数据表.xls')
m=num1(:,6)
n=num1(:,7)
hold on
for i=1:length(x)
if(strcmp(z(i),'A'))
plot(x(i),y(i),'.');
if(m(i)==1)
plot(x(i),y(i),'ro');
end
if(n(i)==1)
plot(x(i),y(i),'r*');
end
end
end
line1=num2(:,1)
line2=num2(:,2)
hold on
for i=1:length(x)
if(strcmp(z(i),'A'))
plot(x(i),y(i),'.');
if(m(i)==1)
plot(x(i),y(i),'ro');
end
if(n(i)==1)
plot(x(i),y(i),'r*');
end
end
end
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))]);
end
end
end
hold on
for i=1:length(x)
if(strcmp(z(i),'A'))
plot(x(i),y(i),'.');
if(m(i)==1)
plot(x(i),y(i),'ro');
end
if(n(i)==1)
plot(x(i),y(i),'r*');
end
text(x(i),y(i),num2str(i));
end
end %%%%%%差一个点就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))]);
end
end
end ----------------------
hold on
for i=1:length(x)
plot(x(i),y(i),'.');
if(m(i)==1)
plot(x(i),y(i),'ro');
end
if(n(i)==1)
plot(x(i),y(i),'r*');
end
end
for i=1:length(line1)
line([x(line1(i)),x(line2(i))],[y(line1(i)),y(line2(i))]);
end
end
hold on
for i=1:length(x)
plot(x(i),y(i),'.');
if(m(i)==1)
plot(x(i),y(i),'ro');
end
if(n(i)==1)
plot(x(i),y(i),'r*');
end
end
for i=1:length(line1)
line([x(line1(i)),x(line2(i))],[y(line1(i)),y(line2(i))]);
•
end
hold on
for i=1:length(x)
plot(x(i),y(i),'.');
if(m(i)==1)
plot(x(i),y(i),'ro');
end
if(n(i)==1)
plot(x(i),y(i),'r*');
end
end
for i=1:length(line1)
line([x(line1(i)),x(line2(i))],[y(line1(i)),y(line2(i))]);
•
end
hold on
for i=1:length(x)
if(strcmp(z(i),'A'))
plot(x(i),y(i),'.');
if(m(i)==1)
plot(x(i),y(i),'ro');
end
if(n(i)==1)
plot(x(i),y(i),'r*');
end
text(x(i),y(i),num2str(i));
end
end
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))]);
end
end
end
hold on
for i=1:length(x)
if(strcmp(z(i),'A'))
plot(x(i),y(i),'.');
if(m(i)==1)
plot(x(i),y(i),'ro');
end
if(n(i)==1)
plot(x(i),y(i),'r*');
end
text(x(i),y(i),num2str(i));
end
end
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))]);
end
end
end
hold on
for i=1:length(x)
if(strcmp(z(i),'A'))
plot(x(i),y(i),'.');
if(m(i)==1)
plot(x(i),y(i),'ro');
end
if(n(i)==1)
plot(x(i),y(i),'r*');
end
text(x(i),y(i),num2str(i));
end
end
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))]);
end
end
end
for i=1:length(line1)
line([x(line1(i)),x(line2(i))],[y(line1(i)),y(line2(i))]);
end
hold on
for i=1:length(x)
plot(x(i),y(i),'.');
if(m(i)==1)
plot(x(i),y(i),'ro');
end
if(n(i)==1)
plot(x(i),y(i),'r*');
end
text(x(i),y(i),num2str(i)); end
end
for i=1:length(line1)
line([x(line1(i)),x(line2(i))],[y(line1(i)),y(line2(i))]);
end ---------------------全图
hold on
for i=1:length(x)
plot(x(i),y(i),'.');
if(m(i)==1)
plot(x(i),y(i),'ro');
end
if(n(i)==1)
plot(x(i),y(i),'r*');
end
end
for i=1:length(line1)
line([x(line1(i)),x(line2(i))],[y(line1(i)),y(line2(i))]);
end
tmp=cat(2)
tmp1=1;
for i=1:length(line1)
if(line1(i)<=92)
if(line2(i)<=92)
tmp(tmp1,1)=line1(i)
tmp(tmp1,2)=line2(i)
end
end
end
xlswrite('tmp.xls',tmp)
hold on
for i=1:length(x)
if(strcmp(z(i),'A'))
plot(x(i),y(i),'.');
if(m(i)==1)
plot(x(i),y(i),'ro');
end
if(n(i)==1)
plot(x(i),y(i),'r*');
end
text(x(i),y(i),num2str(i));
end
end
-----
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))]);
end
end
end
------
hold on
for i=1:length(x)
plot(x(i),y(i),'.');
if(m(i)==1)
plot(x(i),y(i),'ro'); end
if(n(i)==1)
plot(x(i),y(i),'r*');
end
描点
end
---------
for i=1:length(line1)
line([x(line1(i)),x(line2(i))],[y(line1(i)),y(line2(i))]);
end
tmp=cat(2)
tmp1=1;
for i=1:length(line1)
if(line1(i)<=92)
if(line2(i)<=92)
tmp(tmp1,1)=line1(i)
tmp(tmp1,2)=line2(i)
end
end
end
xlswrite('tmp.xls',tmp)
clc;clear
ShapeX = [
413
403
383.5
381
339
335
317
334.5
333
282
247
219
225
280
290
337
415
432
418
444
251
234
225
212
227
256
250.5
243
246
314
315
326
327
328
336
331
371
388.5
411
419
411
394
342
325
315
342
345
348.5
351
348
370
371
354
363
357
351
369
335
381
391
392
395
398
401
405
410
408
415
418
422
418.5
405.5
405
409
417
420
424
438
438.5
434
438
440
447
448
444.5
441
440.5
];
ShapeY = [
359
343
351
377.5
376
383
362
353.5
342
325
301
316
270
292
335
328
335
371
374
394
277
271
265
290
300
301
306
328
337
367
351
355
350
342.5
339
334
335
330
333
330.5
327.5
344
343
346
342
348
372
374
372
382
380.5
377
369
363
353
374
382.5
387
382
388
395
381
375
366
361
362
359
360
355
350
351
347
354
356
364.5
368
370
364
370
372
368
373
376
385
392
381
383
385
381.5
];
N=length(ShapeX);
for i=1:N
for j=1:N
Distance(i,j)=sqrt((ShapeX(i)-ShapeX(j))^2+(ShapeY(i)-ShapeY(j))^2);
end
end
Distance
A=zeros(N);
Max_Value=zeros(N);
for k=1:N
[max_line,column]=max(Distance(k,:));
A(k,column)=max_line;
end
Max_Value(k,column)=max(max(A))
[I,J]=find(Max_Value)
point_start=[ShapeX(I) ShapeY(I)]
point_end=[ShapeX(J) ShapeY(J)]
hold on
for i=1:length(x)
if(strcmp(z(i),'A'))
plot(x(i),y(i),'.');
if(m(i)==1)
plot(x(i),y(i),'ro');
end
if(n(i)==1)
plot(x(i),y(i),'r*');
end
text(x(i),y(i),num2str(i));
end
end
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))]);
end
end
end
hold on
for i=1:length(x)
if(strcmp(z(i),'A'))
plot(x(i),y(i),'.');
if(m(i)==1)
plot(x(i),y(i),'ro');
end
if(n(i)==1)
plot(x(i),y(i),'r*');
end
text(x(i),y(i),num2str(i));
end
end
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))]);
end
end
end
x=
x=num(:,2)
[num2,data2]=xlsread('C:\\Users\\yaokaiqian\\Desktop\\cumcm2011Problems中文版\\B\\cumcm2011B附件2_全市六区交通网路和平台设置的数据表.xls')
hold on
for i=1:length(x)
if(strcmp(z(i),'A'))
plot(x(i),y(i),'.');
if(m(i)==1)
plot(x(i),y(i),'ro');
end
if(n(i)==1)
plot(x(i),y(i),'r*');
end
text(x(i),y(i),num2str(i));
end
end
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))]);
end
end
end
hold on
for i=1:length(x)
plot(x(i),y(i),'.');
if(m(i)==1)
plot(x(i),y(i),'ro');
end
if(n(i)==1)
plot(x(i),y(i),'r*');
end
end
for i=1:length(line1)
line([x(line1(i)),x(line2(i))],[y(line1(i)),y(line2(i))]);
end
hold on
for i=1:length(x)
if(strcmp(z(i),'A'))
plot(x(i),y(i),'.');
if(m(i)==1)
plot(x(i),y(i),'ro');
end
if(n(i)==1)
plot(x(i),y(i),'r*');
end
text(x(i),y(i),num2str(i));
end
end
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))]);
end
end
end
因篇幅问题不能全部显示,请点此查看更多更全内容
Copyright © 2019- zicool.com 版权所有 湘ICP备2023022495号-2
违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务