subplot.m

来自「这是一个SA求解tsp旅行商的matlab源代码」· M 代码 · 共 21 行

M
21
字号
function plot(x0)
global dist;
global citynumber;
subplot(1,2,1);
plot( iters(1,:), iters(2,:) ), xlabel('迭代次数'), 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 + =
减小字号Ctrl + -
显示快捷键?