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