How can I change the output of the code to scalar?
7 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Peter Mwangi
il 12 Feb 2018
Risposto: Peter Mwangi
il 15 Feb 2018
I am trying to find the optimal values of a function @poweroptone but the GA tool doesn't complete the optimization because of the vector error. To be precise, this is the error that pops up `Error running optimization. Your fitness function must return a scalar value.` Here is the code:
function Pmax = poweroptone(Lt, R)
Lt =(0.01:0.0005:0.07);
R=(4:0.025:7);
Pmax =((1222.714521).*sqrt(Lt).*sqrt(0.03 + Lt./2).*sqrt(R./(R - 1)).*((sqrt(0.27) - 1.054.*sqrt(0.03 + Lt))./(sqrt(0.27).*(sqrt(0.03 - Lt)))));
end
The number of variables are two (2). How can I change the output of the code to scalar?
4 Commenti
Risposta accettata
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Genetic Algorithm in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!