Problem concerning the fitness function of the genetic algorithm on MATLAB.

조회 수: 1 (최근 30일)
Hi everyone,
I need your help for this problem. The fitness function I am considering for my project is the error between two output signals of two simulink models and it has to be the smallest possibile. This is a piece of the code I wrote.
where iHF is a .mat file with dimension 2x50001, iLF is a normal output array with dimension 50001x1 and simulation.DT is the sampling time equal to 1e-5.
The formula to calculate the error is the following:
When I run the matlab code containing the optimization parameters, it gives me an error saying "Your fitness function must return a scalar value".
What should I do?

채택된 답변

Matt J
Matt J 2021년 2월 15일
편집: Matt J 2021년 2월 15일
Make y1 and y2 the same size and shape (i.e., make sure both are row vectors or both column vectors).

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Genetic Algorithm에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by