f.m

来自「量子遗传算法用于图象处理 量子遗传算法用于图象处理」· M 代码 · 共 25 行

M
25
字号
function f=f(alpha_best,beta_best,alpha_curr,beta_curr)
d1=alpha_best*beta_best;
d2=alpha_curr*beta_curr;
e1=atan(beta_best/alpha_best);
e2=atan(beta_curr/alpha_curr);
if d1>0&d2>0
    if abs(e1)>abs(e2)
        f=1;
    else 
        f=-1;
    end
end
if d1>0&(not(d2>0))
    f=1;
end
if (not(d1>0))&d2>0
    f=-1;
end
if (not(d1>0))&(not(d2>0))
    if abs(e1)>abs(e2)
        f=-1;
    else
        f=1;
    end
end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?