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.

1 view (last 30 days)
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 ??

Accepted Answer

Walter Roberson
Walter Roberson on 14 Feb 2016
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 Comments
Walter Roberson
Walter Roberson on 29 Mar 2019
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.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!