gusucode.com > 《遗传算法工具箱及应用》的源代码 > 《遗传算法工具箱及应用》的源代码/gatbx/gatbx-example/gatbx/poll_example.m

    function z = poll_example(x)
if x(1)^2 + x(2)^2 <= 25
    z = x(1)^2 + x(2)^2 - 25;
elseif x(1)^2 + (x(2) - 9)^2 <= 16
    z = x(1)^2 + (x(2) - 9)^2 - 16;
else z = 0;
end