![]() |
此代码如何修改能正常运行??matlab6.5
高手帮帮忙吧!俺调试了半天都出错.... 遗传算法的部分...谢谢了
p = [ 0 17 40 65 89 113 137 160; 0.24 0.77 1.19 1.53 1.72 1.94 2.03 2.26; 141 90 75 36 33 27 37 22; 0 55 42.2 34.4 31.7 32.9 31.0 27.9; ]; % 发酵过程中的变量 t = [0 63 100 72 69 42 41 36]; % 青霉素产量 net =newff( minmax(p),[4,1],{'tansig' 'purelin'},'trainlm'); %创建BP网络 % BP网络参数设置开始 % net.trainParam.show=10; net.trainParam.epochs=1000; net.trainParam.mc=0.9; net.trainParam.lr=0.05; net.trainParam.lr_inc=1.01; net.trainParam.goal=0.001; % BP网络参数设置结束 % [net ,tr]= train(net,p,t); % 进行网络训练 %y=sim(net,p); % 对结果进行仿真 %ga函数原型 %funciton[x,endPop,bPop,traceInfo]=ga(bounds,eevalFN,eevalOps,strartPop,opts,termFN, % termOps,selectFN,selectOps,xOverFNs,xOverOps,mutFNs,mutOps) %[x, endPop,bPop]=ga([0 160; 0 3 ; 0 150 ; 0 60; 0 100],net,) initPop = initializega(10,[0 100],'net'); %随机生成10种群 [x endPop]= ga([ 0 100],'net',[],initPop,[1e-5 1 1]... ,'maxGenTerm',1,'normGeomSelect',[0.08],['arithXover'],... [20],'nonUnifMutation',[2 1 3] ); %迭代1次 x1=x,endpop=endPop; [x endPop bPop trace]= ga([ 0 100],'net',[],initPop,[1e-6 1 1]... ,'maxGenTerm',25,'normGeomSelect',[0.08],['arithXover'],[2],... 'nonUnifMutation',[2 25 3]); %迭代25次 x2=x,endpop2=endPop,bpop=bPop,TRACE=trace; x1,endpop,x2,endpop2,bpop,TRACE; %输出结果 :cry: :cry: :cry: |
所有时间均为北京时间。现在的时间是 11:21。 |
Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.