Error using ga (line 283) - Matlab newbie

1 visualización (últimos 30 días)
Antonia Schmidt
Antonia Schmidt el 23 de Ag. de 2017
Respondida: José-Luis el 23 de Ag. de 2017
I am trying to minimize my equation (see fitnessfcn) and to solve it to x.
w = [-2.513, 0.2409, 2.3219];
l = [118, 104, 119];
N = 3;
nvars = 3;
b = 119 ;
fitnessfcn = sum (w(1:N).* ((abs(x-l(1:N)).*abs(x-l(1:N))) .* log(abs(x-l(1:N)))))-b;
[x, fval] = ga(fitnessfcn, nvars)
I am officially frustrated and need help. Thanks in advance!
  1 comentario
KSSV
KSSV el 23 de Ag. de 2017
We cannot run this as x is not defined here.

Iniciar sesión para comentar.

Respuestas (1)

José-Luis
José-Luis el 23 de Ag. de 2017
fitnessfcn should be a function handle. It doesn't look like that's what you are passing.
fitnessfcn = @(x) x.^2;
For example.

Categorías

Más información sobre Statistics and Machine Learning Toolbox en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by