【matlab】《图论》-完全图仿真

来源:互联网 发布:华为交换机端口ip 编辑:程序博客网 时间:2024/06/09 20:42
% % 完全图close all;N=30;t=0: 2*pi/N: 2*pi;x = sin(t); y = cos(t);figure('Name','Point-Line');hold on;% plotx-y linesfor n = 1: N-1    for m = (n+1): N         plot(x([n,m]), y([n,m]), 'b-');        endendplot(x(:),y(:),'rp');  xlabel('x');ylabel('y');title('Point-Line');hold off;% axis off%{x = [1000,2711;1210,2770;1041,2610;1499,2528;850,2482;1770,2180;1970,2218;...     1790,2155;1333,2175;1140,2100;1320,2070;1215,2052;1160,1870;776,1799;...     1360,1750;1520,1721;1420,1470;1770,1390;1380,1280;1120,1675;978,1668;...     910,1511;1220,1424;1020,1330;1081,1160;600,1511;615,1498;720,1440;...     680,1370;702,1290;731,1220;670,1160;810,1120;708,1131;572,1050;...     878,656;888,592;417,630;];figure('Name','Point-Line');hold on;% plot linefor n = 1 : length(x)-1 %做37次足矣    for m = (n+1) : length(x)               plot(x([n,m],1),x([n,m],2),'b-');%每个点与其他37个点相连    endendplot(x(:,1),x(:,2),'rp');  xlabel('x');ylabel('y');title('Point-Line');hold off;%}

0 0
原创粉丝点击