genetic algorithm error not enough input arguments
Ältere Kommentare anzeigen
function deltaH = curvefit_H_2modes(w1,w2,m1,m2,c1,c2)
load('file.mat');
z = -(x.^2) .* ((1 ./ ((w1.^2 * m1) - (x.^2 * m1) + (1i * x * c1))) + ...
(1 ./ ((w2.^2 * m2) - (x.^2 * m2) + (1i * x * c2))));
deltaH = sum(abs(z - y).^2);
end
Ok, now I use the Genetic Algorithm in the Global Optimization Toolbox and input @curvefit_H_2modes as my fitness function and I input 6 as the number of variables. Then I click on Start to run the GA solver. I get an error message saying "Not enough input arguments" ... WHY?! My function takes 6 input arguments. The function loads a file which has two vectors, x and y (experimental data).
I can run the function myself using estimates for the 6 input variables and it runs perfectly. Why does the GA have a problem with it?
1 Kommentar
Craig Cowled
am 23 Mai 2013
Akzeptierte Antwort
Weitere Antworten (3)
Craig Cowled
am 23 Mai 2013
0 Stimmen
Craig Cowled
am 24 Mai 2013
Ali Meghdadi
am 1 Dez. 2013
0 Stimmen
hi, I also have somehow the same problem. My constraint function has 8 parameters as input and gives an output and GA doesn't accept it. what can I do?
1 Kommentar
Alan Weiss
am 2 Dez. 2013
Please look at the accepted answer for the solution to your problem.
If that doesn't work, then provide more detail, such as the syntax you are using, and the error GA returns.
Alan Weiss
MATLAB mathematical toolbox documentation
Kategorien
Mehr zu Genetic Algorithm finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!