📄 gaplotbestfun.m
字号:
function state = gaplotbestfun(options,state,flag)%GAPLOTBESTF Plots the best score and the mean score.% STATE = PLOTBEST(OPTIONS,STATE,FLAG) plots the best score as well% as the mean of the scores.%% Example:% Create an options structure that will use PLOTBEST% as the plot function% options = gaoptimset('PlotFcns',@plotbest);% Copyright 2004 The MathWorks, Inc. % $Revision: 1.9 $ $Date: 2004/01/16 16:51:50 $if(strcmp(flag,'init')) set(gca,'xlim',[1,options.Generations]); xlabel('Generation','interp','none'); grid on ylabel('Fitness value','interp','none');endhold on;generation = state.Generation;best = min(state.Score);plot(generation,best, 'v');title(['Best: ',num2str(best)],'interp','none')hold off;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -