Skip to main content
. 2026 Oct 1;26(19):6247. doi: 10.3390/s26196247
Algorithm 1 Improved statistical model for the simulation of soft responses based on the model proposed in [20].
  •   1:

    Input: K, μcountu, σcountu, μLLRu, σLLRu, μcounte, σcounte, μLLRe, σLLRe, Lmax

  •   2:

    Output: Lref, Lres

  •   3:

    R← create zero vector of length K                                                                                     ▷Variable initialization

  •   4:

    Rref← create zero vector of length K

  •   5:

    U← random sample using μcountu,σcountu2                                 ▷ Sample number of unstable bits and bit errors

  •   6:

    E← random sample using μcounte,σcounte2

  •   7:

    Uvec← select U random indices from R                           ▷ Determine positions of unstable bits and bit errors

  •   8:

    Evec← select E random indices from R

  •   9:

    for each index i in Uvec do                                                                                                   ▷ Simulate unstable bits

  • 10:

        tmpVar← random sample using μLLRu,σLLRu2                                                                        ▷ Sample LLR value

  • 11:

        if abs(tmpVar)>Lmax then                                                                              ▷ Generate simulated response

  • 12:

            R[i]←sign(tmpVar)·Lmax

  • 13:

        else

  • 14:

            R[i]←tmpVar

  • 15:

        end if

  • 16:

        if R[i]>0 then                                                                                                      ▷ Generate reference response

  • 17:

            Rref[i]←Lmax

  • 18:

        else if R[i]<0 then

  • 19:

            Rref[i]←−Lmax

  • 20:

        else

  • 21:

            Rref[i]←rand{−1,+1}·Lmax

  • 22:

        end if

  • 23:

    end for

  • 24:

    for each index j in Evec do                                                                                                     ▷ Simulate bit errors

  • 25:

        tmpVar← random sample using μLLRe,σLLRe2                                                                   ▷ Sample LLR value

  • 26:

        if abs(tmpVar)>Lmax then                                                                            ▷ Generate simulated response

  • 27:

            R[j]←sign(tmpVar)·Lmax

  • 28:

        else

  • 29:

            R[j]←tmpVar

  • 30:

        end if

  • 31:

        if R[j]>0 then                                                                                                  ▷ Generate reference response

  • 32:

            Rref[j]←−Lmax

  • 33:

        else if R[j]<0 then

  • 34:

            Rref[j]←Lmax

  • 35:

        else

  • 36:

            Rref[j]←rand{−1,+1}·Lmax

  • 37:

        end if

  • 38:

    end for

  • 39:

    for each remaining index k in R not in (Uvec∪Evec) do                                          ▷ Generate stable response

  • 40:

        R[k]←rand{−1,+1}·Lmax

  • 41:

        Rref[k]←R[k]

  • 42:

    end for

  • 43:

    Lref←Rref

  • 44:

    Lres←R

  • 45:

    return Lref, Lres