|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?我要加入
x
function[sol,eval]=gademo1eval(sol,options)
x=solve(1)
eval=x+10*sin(5*x)+7*cos(4*x);
clc
fplot('x+10*sin(5*x)+7*cos(4*x)',[0 9])
initPop=initializega(10,[1 9],'gademoleval');
plot(initPop(:,1),initPop(:,2),'b*')
[x endPop]=ga([0 9],'gademoleval',[],initPop,[le-5 1 1],'maxGenTerm',1,'normGeomSelect',[0.08],[arithXover'],[20],'nonUnifMutation',[2 1 3]);
plot(endPop(:,1),endPop(:,2),'bo')
[x endPop bpop trace]=ga([0 9],'gademoleval',[],initPop,[le-6 1 1],'maxGenTerm',25,'normGeomSelect',[0.08],[arithXover'],[2],'nonUnifMutation',[2 25 3]);
plot (endPop(:,1),endPop(:,2),'y*')
figure(2)
plot(trace(:,1),trace(:,3),'y-')
hold on
plot(trace(:,1),trace(:,2),'r-')
xlabel('Generation');ylabel('Fittness');
legend
问题:
??? Error using ==> eval
Undefined command/function 'gademoleval'.
Error in ==> initializega at 80
eval(estr);
Error in ==> gademo1 at 6
initPop=initializega(10,[1 9],'gademoleval'); |
|