Hello ... the objective here is maximizing Z for each product (i)

function [ Zi ] = myfitness( X )

P=X(1);

C=X(2);

Q=X(3);

% Zi= fitness value

% C,P,Q = variables vectors

for i=1:10;

Zi = P(i).*Q(i)-C(i).*Q(i);

end

end

the outputs should be a 1*n matrice

when i run the function it works but i get only one value , and doesn't work with ga toolbox i keep getting the same error (index exceeds Matrix dimensions) ....how can i fix this error?

any help would be appreciated ....Thank you

Similar questions and discussions