Is there a way to define the values for the nvars variables they are incremented in steps, instead of all intermediary values defined in the bounds for running genetic algorithm.

7 次查看(过去 30 天)
Hello Matlab engineers,
I have 4 optimization variables for the GA : * fstopb: the stopband frequency : (0.75:0.01:0.95) * wtrans: width of the transition band :linspace(0.208,0.1250,10) * deltas: the stop band attenuation in db : linspace(20,220,20) * deltap: the pass band ripple in db : linspace(2,10,25) I want these 4 nvars to take on specifically the values returned by the arrays, instead of all the values in between the bounds...is there a way ??

采纳的回答

Walter Roberson
Walter Roberson 2016-2-14
Use integer constraints between 1 and 25 (inclusive), and use that x to index the array that has linspace(2,10,25) stored in it in order to determine the value you want to compute with.
  4 个评论
Walter Roberson
Walter Roberson 2019-3-29
For example,
v1 = 0.75:.01:0.95;
v2 = linspace(0.208, 0.1250,10);
fun = @(x) v1(x(1)).^2 - sqrt(v2(x(2))), 1:2, [], [], [], [], [1 1], [length(v1), length(v2)])
x(1) and x(2) are integer constrained, but you can use those integers to index into the value 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