当前位置:网站首页>SISO decoder for a general (n, n-1) SPC code (supplementary Chapter 3)
SISO decoder for a general (n, n-1) SPC code (supplementary Chapter 3)
2022-06-11 18:13:00 【Bai Xiaosheng of Ming Dynasty】
Preface :
The earlier SPC(3,2) Here, expand to SPC(n,n-1)
The length of the data sent is n-1, after SPC The code formation length is n Of
codeword.
Catalog
1: Overall process
2: Simplify the algorithm
3: code
One Overall process

I know before
intrinsic LLR


Mainly in the calculation extrinsic LLR , stay SPC(3,2) in , With L1 For example
In the same way, we can get
More commonly :
Method of proof : Through mathematical induction , Reference resources SPC(3,2), It's still a tanh Function multiplication

Two Simplify the algorithm
2.1 Symbolic calculation


sgn=1: Corresponding c=0, Parity successful , keep
unchanged
sgn=-1: Corresponding c=1, Parity failed ,
Flip
2.2 Size calculation
Follow SPC(3,2) equally , There is a simpler way to do this , You don't have to divide yourself every time 
3、 ... and code
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 10 09:23:37 2022
@author: chengxf2
"""
import numpy as np
"""
AWGN: QPSK After modulation , Add noise , It is assumed that all the messages sent are 1(0->1)
args
std: Standard deviation
mu: mean value
n: Number of samples
"""
def sendmessage(mu=0,sigma=1.0,n=6):
#np.random.seed(5)
s = 1.0+ np.random.normal(mu, sigma, n)
#sr = 1+std*np.random.randn(1,n)
print("\n step1 send data : ", s)
return s
'''
obtain channel LLR, intrinsic
args
rList: From the channel itself LLR
sigma: variance
n: Number of samples
'''
def getIntrLLR(rList, sigma,n=6):
left = 2.0/sigma
llrList = []
for r in rList:
llr = np.round(left*r,2)
llrList.append(llr)
print("\n step2 intrinsic llr ",llrList)
return llrList
'''
Get symbolic function
arg
llr: likelihood ratio
return
Symbol
'''
def sign(llr):
if llr>0:
return 1
else:
return -1
'''
Get symbols ,hardDecsion The process
args
llrList
return
sgn: Overall sign
sgnList: For each sign
'''
def getSign(llrList):
sgn = 1
sgnList = []
for llr in llrList:
sgn_i = sign(llr)
sgnList.append(sgn_i)
sgn = sgn*sign(llr)
print("\n step3 get sign",sgn,"\t sgnList ",sgnList)
return sgn,sgnList
'''
Find the minimum , And position , Find a small value
'''
def minimum(llrList):
#llrList.sort()
print("\n step4 minimum",llrList)
n = len(llrList)
min1 = llrList[0]
min2 = llrList[0]
minpos = 0
for i in range(1,n):
llr = llrList[i]
if llr<min1:
min1 = llr
minpos = i
else:
min2 = llr # Guarantee min2 It's definitely better than min1 Big enough
#print("\n min1: %4.2f minpos: %d"%(min1,minpos))
for j in range(n):
llr = llrList[j]
if j==minpos:
continue
if llr<min2:
min2 = llr
print("\n min1: %4.2f minpos: %d min2: %4.2f "%(min1,minpos,min2))
return min1,min2, minpos
def getextrinsic(sgn, sgnList,min1,min2, minpos):
n = len(sgnList)
sgn_extrinsic = np.multiply(sgn, sgnList)
print("\n sgn_extrinsic ",sgn_extrinsic,)
extrinsicLLR =[]
for i in range(n):
if i == minpos:
llr = min2
else:
llr = min1
extrinsicLLR.append(llr)
extLLR = np.multiply(sgn_extrinsic, extrinsicLLR)
print("\n extLLR ",extLLR)
return extLLR
'''
to update llr
'''
def updateLLR(intrinsicLLR, extrinsicLLR):
llr = intrinsicLLR+extrinsicLLR
print("\n llr ",llr)
if __name__ =="__main__":
sigma = 0.8**2
s = sendmessage(0, sigma, 6)
intLLR = getIntrLLR(s, sigma)
sgn,sgnList = getSign(intLLR)
absLLR = np.abs(intLLR)
min1,min2, minpos =minimum(absLLR)
extLLR =getextrinsic(sgn,sgnList,min1,min2, minpos)
updateLLR(intLLR, extLLR) 
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 10 08:44:34 2022
@author: chengxf2
"""
#-*-coding:utf-8-*-
"""
python Draw a standard normal distribution curve
"""
# ==============================================================
import numpy as np
import math
import matplotlib.pyplot as plt
def gd(x, mu=0, sigma=1.0):
""" Generate the data
Argument:
x: array
input data ( The independent variables )
mu: float
mean value
sigma: float
variance
"""
left = 1 / (np.sqrt(2 * math.pi) * np.sqrt(sigma))
right = np.exp(-(x - mu)**2 / (2 * sigma))
return left * right
if __name__ == '__main__':
# The independent variables
x = np.arange(-4, 5, 0.1)
# The dependent variable ( Different mean or variance )
y_1 = gd(x, 0, 2.0)
y_2 = gd(x, 0, 1.0)
y_3 = gd(x, 0, 5.0)
y_4 = gd(x, 0, 0.2)
# mapping
plt.plot(x, y_1, color='green')
plt.plot(x, y_2, color='blue')
plt.plot(x, y_3, color='yellow')
plt.plot(x, y_4, color='red')
# Set the coordinate system
plt.xlim(-5.0, 5.0)
plt.ylim(-0.2, 1)
# because axes Four axes will be obtained , And we only need two axes , So we need to hide the other two axes , Set the color of the top and right axes to none, Will not show
ax = plt.gca()
ax.spines['right'].set_color('none')
ax.spines['top'].set_color('none')
ax.xaxis.set_ticks_position('bottom')
ax.spines['bottom'].set_position(('data', 0))
ax.yaxis.set_ticks_position('left')
ax.spines['left'].set_position(('data', 0))
plt.legend(labels=['$\mu = 0, \sigma^2=2.0$', '$\mu = 0, \sigma^2=1.0$', '$\mu = 0, \sigma^2=5.0$', '$\mu = 0, \sigma^2=0.2$'])
plt.show()
边栏推荐
- 如何学习和自学
- Cryptology Summary
- Spring 2021 daily question [week5 not finished]
- Hash table, inheritance
- Global and Chinese markets for ultra high speed printers 2022-2028: Research Report on technology, participants, trends, market size and share
- 6-3 reading articles (*)
- 7-2 h0107. Pig-Latin
- LeetCode_ Prefix tree_ Medium_ 208. implement trie (prefix tree)
- Hwang
- Merge K ascending linked lists ---2022/02/26
猜你喜欢

Bracket generation ---2022/02/25

Nocturnal installs APK and BP agent

Retrofit source code analysis

Database lock and transaction isolation level

ctf入门

Cryptology Summary
![[collect first and use it sooner or later] 49 Flink high-frequency interview questions series (I)](/img/c4/eb57b29700b6c033f6d0af2892f7a6.png)
[collect first and use it sooner or later] 49 Flink high-frequency interview questions series (I)

【新手上路常见问答】关于项目管理

Ffmpeg hard codec inter QSV

Ffmpeg hardware codec NVIDIA GPU
随机推荐
Chorus translation
SQL报错注入1
Sword finger offer (2nd Edition)
[pat grade B question bank] complete summary
单选按钮 文字背景同时改变
Initial experience of MariaDB spider sharding engine
Tle6288r is a 6-channel (150 MOhm) intelligent multi-channel switch using intelligent power technology - keshijin mall
Intelligent overall legend, legend of wiring, security, radio conference, television, building, fire protection and electrical diagram [transferred from wechat official account weak current classroom]
Hash table, inheritance
Spring 2021 daily question [week6 not finished]
EditText 金额限制
Say no to credit card fraud! 100 lines of code to realize simplified real-time fraud detection
Radiogroup dynamically add RadioButton
Bracket generation ---2022/02/25
sqli-labs通关嘿嘿~
Install MariaDB 10.5.7 (tar package installation)
Sqli labs customs clearance hey hey~
Database lock and transaction isolation level
LeetCode_ Prefix tree_ Medium_ 208. implement trie (prefix tree)
Hwang





