?? matlab畫圖文件.m
字號:
%TSP問題的統計與畫圖
iterfile = fopen( 'c:\SA_Iters_File_eil51_10.txt', 'rt' );
cityfile = fopen( 'c:\SA_Citys_File_eil51_10.txt', 'rt' );
if( iterfile == -1 || cityfile == -1 )
display( 'File not exist!!' );
exit;
end
iters = fscanf( iterfile, '%d %f %f',[ 3,inf] );
citys = fscanf( cityfile, '%f %f',[ 2,inf] );
fclose( iterfile );
fclose( cityfile );
subplot(1,2,1);
plot( iters(2,:), iters(3,:) ), xlabel('迭代時間s'), ylabel('最短路徑路程'), title('路徑優化過程');
subplot(1,2,2);
plot( citys(1,:), citys(2,:),'-b' ), xlabel('X坐標'), ylabel('Y坐標'), title('求解路徑');
hold on;
plot( citys(1,1), citys(2,1), 'r*', 'MarkerSize', 12 );
for i = 2:length(citys)
if( mod( i, 2 ) == 1 )
plot( citys(1,i), citys(2,i), 'r*', 'MarkerSize', 4 );
else
plot( citys(1,i), citys(2,i), 'bs', 'MarkerSize', 4 );
end
end
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -