You have
H(x(1):x(2)).'-K(x(1):x(2)).'-F(3:6).'
x(1) can be in the range 2 to 8, and x(2) can be 3 to 9 according to the LB and UB constraints. The LB and UB constraints are the only ones guaranteed to be satisfied at all times (others might only be satisfied at generation boundaries.) So x(1):x(2) can range from 8:3 (length 0) to 2:9 (length 8). But that expression, H(x(1):x(2)).'-K(x(1):x(2)).', which can be length anywhere from 0 to 8, must match the size of F(3:6) (length 4).
If your constraints are intended to enforce that x(2) = x(1) + 3 (so that F(3:6) will match on length) then rewrite your formula into one variable, substituting x(1)+3 for each occurrence of x(2).
The variable-length array extractions in your S formula are suspicious.
It appears to me that you have also neglected a fundamental fact: the objective function for ga() must return a scalar unless you have options with 'UseVectorized' set to true. You are returning a vector.
If you are wanting to do a pareto front calculation then you need to be using gamultiobj()
Best Answer