⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 example5_9.m

📁 MATLAB7辅助控制系统设计与仿真 第5章
💻 M
字号:
function [sol,eval] = coranaMin(sol,options)
numVar=size(sol,2)-1;
eval = corana(sol(1:numVar));
eval = -eval;
%设置变量的边界

bounds = ones(4,1)*[-10000 10000];
%遗传算法优化
[p,endPop,bestSols,trace]=ga(bounds,'coranaMin');

%性能跟踪
plot(trace(:,1),trace(:,3),'y-')
hold on
plot(trace(:,1),trace(:,2),'r-')
xlabel('Generation');
ylabel('Fittness');
legend('解的变化','种群平均值的变化');

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -