让窃听者猜测哪张图是正确的并计算它需要多少次? (MATLAB)

Having an eavesdropper guess which graph is the correct one and counting how many times it takes? (MATLAB)

所以思路是,有四种情况:HH、LL、LH、HL。其中每一个都基于标准正态 RNG (randn(n,1))。窃听者进行测量并记录下来;其中一个与四个中的任何一个相同。我正在尝试编写一个程序,计算窃听者破案所需的次数,误差在 1% 以内。例如,HH 的第一个点可能与 LL 的第一个点相同;这就是为什么窃听者需要继续进行测量,直到排除可能性,只剩下一种情况。每个案例1000分:

n = 1000;

我的方法是,计算测量案例与四种案例之间的差异:

diffHH = M - HH;
diffLL = M - LL;
diffHL = M - HL;
diffLH = M - LH;

然后,我写了四个 for 循环来检查每种情况:

for guesses = 1:1:n
    if (abs(diffHH(guesses)) <= 0.01) 
        if (abs(diffHH(guesses)) <= 0.01) && (abs(diffLL(guesses)) <= 0.01)
            continue;
        elseif (abs(diffHH(guesses)) <= 0.01)&& (abs(diffHL(guesses)) <= 0.01)
            continue;
        elseif (abs(diffHH(guesses)) <= 0.01) && (abs(diffLL(guesses)) <= 0.01)
            continue;
        else
            disp('Eve guesses HH');
            break;
        end
    end
end
for guesses = 1:1:n
    if (abs(diffLL(guesses)) <= 0.01) 
        if (abs(diffLL(guesses)) <= 0.01) && (abs(diffHH(guesses)) <= 0.01)
            continue;
        elseif (abs(diffLL(guesses)) <= 0.01)&& (abs(diffHL(guesses)) <= 0.01)
            continue;
        elseif (abs(diffLL(guesses)) <= 0.01) && (abs(diffLH(guesses)) <= 0.01)
            continue;
        else
            disp('Eve guesses LL');
            break;
        end
    end
end
for guesses = 1:1:n
    if (abs(diffHL(guesses)) <= 0.01) 
        if (abs(diffHL(guesses)) <= 0.01) && (abs(diffHH(guesses)) <= 0.01)
            continue;
        elseif (abs(diffHL(guesses)) <= 0.01)&& (abs(diffLL(guesses)) <= 0.01)
            continue;
        elseif (abs(diffHL(guesses)) <= 0.01) && (abs(diffLH(guesses)) <= 0.01)
            continue;
        else
            disp('Eve guesses HL');
            break;
        end
    end
end
for guesses = 1:1:n
    if (abs(diffLH(guesses)) <= 0.01) 
        if (abs(diffLH(guesses)) <= 0.01) && (abs(diffHH(guesses)) <= 0.01)
            continue;
        elseif (abs(diffLH(guesses)) <= 0.01)&& (abs(diffLL(guesses)) <= 0.01)
            continue;
        elseif (abs(diffLH(guesses)) <= 0.01) && (abs(diffHL(guesses)) <= 0.01)
            continue;
        else
            disp('Eve guesses LH');
            break;
        end
    end
end

猜测似乎一直在上升到 1000,但他们不应该;这四种情况完全不同。我到底错过了什么?

"guesses" 为每个循环重新启动;考虑为每个案例使用不同的 "guesses" 名称,例如 "guessesHH," "guessesLL," 等