how can i get solution?
1 view (last 30 days)
Show older comments
ga1.m
--------------
in=[1 2 3 4 5;2 4 3 5 1]
p=in;
p=p'
net=newff([1 5;1 5],[4, 4, 1],{'tansig','tansig','purelin'},'trainlm');
net=init(net);
t=[0.1 0.5 0.6 0.7 0.8]
x=t;
x=x';
net.trainParam.epochs=600;
net.trainParam.show=10;
net.trainParam.mc=0.6;
net.trainParam.lr=0.3;
net.trainParam.goal=0.0001;
net=train(net,p',x');
y=sim(net,p')
disp(y);
objfcn=@(x)-y;
option=gaoptimset;
[xopt,fval]=ga(objfcn,2,option);
disp(fval);
---------------------
errors---
Index exceeds matrix dimensions error in -ga at 182
score=state.score(this population);
error in --ga1 at 19
[xopt,fval]=ga(objfcn,2,option)
------------------------------------------
ga1.m is my file. when I am executing this program in Matlab7.0,above errors are coming.
what would be solution? kindly tell me nyone.
3 Comments
abhijit kulkarni
on 10 Apr 2014
Your program works fine except there is some error in fitness function.
(I simply executed ur code in new m file but selected all lines and executed without saving your file. Caused by: Failure in user-supplied fitness function evaluation. GA cannot continue.
Answers (0)
See Also
Categories
Find more on Particle & Nuclear Physics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!