Error using ga (line 283) - Matlab newbie

조회 수: 1 (최근 30일)
Antonia Schmidt
Antonia Schmidt 2017년 8월 23일
답변: José-Luis 2017년 8월 23일
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
KSSV
KSSV 2017년 8월 23일
We cannot run this as x is not defined here.

댓글을 달려면 로그인하십시오.

답변 (1개)

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

카테고리

Help CenterFile Exchange에서 Statistics and Machine Learning Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by