📄 matlab digital communication - ldpc code.mht
字号:
sans-serif
}
#sidebar-alternate H3 {
PADDING-RIGHT: 0px; BORDER-TOP: #878787 1px dotted; PADDING-LEFT: 0px; =
FONT-WEIGHT: normal; FONT-SIZE: 1em; PADDING-BOTTOM: 6px; MARGIN: 1em =
0px; LINE-HEIGHT: 1; PADDING-TOP: 6px; BORDER-BOTTOM: #878787 1px =
dotted; FONT-FAMILY: "Lucida Grande","Lucida Sans",Verdana, Arial, =
sans-serif
}
#sidebar H4 {
PADDING-RIGHT: 0px; BORDER-TOP: #878787 1px dotted; PADDING-LEFT: 0px; =
FONT-WEIGHT: normal; FONT-SIZE: 1em; PADDING-BOTTOM: 6px; MARGIN: 1em =
0px; COLOR: #515151; LINE-HEIGHT: 1; PADDING-TOP: 6px; BORDER-BOTTOM: =
#878787 1px dotted; FONT-FAMILY: "Lucida Grande","Lucida Sans",Verdana, =
Arial, sans-serif
}
#sidebar-alternate H4 {
PADDING-RIGHT: 0px; BORDER-TOP: #878787 1px dotted; PADDING-LEFT: 0px; =
FONT-WEIGHT: normal; FONT-SIZE: 1em; PADDING-BOTTOM: 6px; MARGIN: 1em =
0px; COLOR: #515151; LINE-HEIGHT: 1; PADDING-TOP: 6px; BORDER-BOTTOM: =
#878787 1px dotted; FONT-FAMILY: "Lucida Grande","Lucida Sans",Verdana, =
Arial, sans-serif
}
#sidebar H5 {
PADDING-RIGHT: 0px; BORDER-TOP: #878787 1px dotted; PADDING-LEFT: 0px; =
FONT-WEIGHT: normal; FONT-SIZE: 0.9em; PADDING-BOTTOM: 6px; MARGIN: 1em =
0px; COLOR: #515151; LINE-HEIGHT: 1; PADDING-TOP: 6px; BORDER-BOTTOM: =
#878787 1px dotted; FONT-FAMILY: "Lucida Grande","Lucida Sans",Verdana, =
Arial, sans-serif
}
#sidebar-alternate H5 {
PADDING-RIGHT: 0px; BORDER-TOP: #878787 1px dotted; PADDING-LEFT: 0px; =
FONT-WEIGHT: normal; FONT-SIZE: 0.9em; PADDING-BOTTOM: 6px; MARGIN: 1em =
0px; COLOR: #515151; LINE-HEIGHT: 1; PADDING-TOP: 6px; BORDER-BOTTOM: =
#878787 1px dotted; FONT-FAMILY: "Lucida Grande","Lucida Sans",Verdana, =
Arial, sans-serif
}
#sidebar H6 {
PADDING-RIGHT: 0px; BORDER-TOP: #878787 1px dotted; PADDING-LEFT: 0px; =
FONT-WEIGHT: normal; FONT-SIZE: 0.8em; PADDING-BOTTOM: 6px; MARGIN: 1em =
0px; COLOR: #515151; LINE-HEIGHT: 1; PADDING-TOP: 6px; BORDER-BOTTOM: =
#878787 1px dotted; FONT-FAMILY: "Lucida Grande","Lucida Sans",Verdana, =
Arial, sans-serif
}
#sidebar-alternate H6 {
PADDING-RIGHT: 0px; BORDER-TOP: #878787 1px dotted; PADDING-LEFT: 0px; =
FONT-WEIGHT: normal; FONT-SIZE: 0.8em; PADDING-BOTTOM: 6px; MARGIN: 1em =
0px; COLOR: #515151; LINE-HEIGHT: 1; PADDING-TOP: 6px; BORDER-BOTTOM: =
#878787 1px dotted; FONT-FAMILY: "Lucida Grande","Lucida Sans",Verdana, =
Arial, sans-serif
}
#adsense {
MARGIN: 30px 14px
}
#footer {
MARGIN-BOTTOM: 10px
}
#footer HR {
DISPLAY: none
}
#footer .wrapper {
PADDING-RIGHT: 20px; PADDING-LEFT: 20px; PADDING-BOTTOM: 5px; =
PADDING-TOP: 5px
}
#threecolumn #sidebar .links {
BACKGROUND: #f7f7f7
}
#sidebar-alternate .alternate-content .wrapper {
PADDING-RIGHT: 10px; PADDING-LEFT: 10px; PADDING-BOTTOM: 1px; =
PADDING-TOP: 1px
}
#sidebar-alternate BLOCKQUOTE {
MARGIN: 0px
}
A:link {
BACKGROUND: url(/-/includes/style/solitude/navy/bg_link.gif); COLOR: =
#24355d
}
A:visited {
BACKGROUND: url(/-/includes/style/solitude/navy/bg_link.gif)
}
BODY {
BACKGROUND: url(/-/includes/style/solitude/navy/bg_top.gif) #fff =
repeat-x center top
}
TH {
BACKGROUND: url(/-/includes/style/solitude/navy/bg_pattern.gif)
}
H1 {
COLOR: #24355d
}
H2 {
COLOR: #24355d
}
H3 {
COLOR: #24355d
}
#header {
BACKGROUND: url(/-/includes/style/solitude/navy/bg_mast.gif) repeat-x =
center center
}
#sidebar H3 {
COLOR: #24355d
}
#sidebar-alternate H3 {
COLOR: #24355d
}
#sidebar-alternate .alternate-content {
BACKGROUND: url(/-/includes/style/solitude/navy/bg_pattern.gif)
}
</STYLE>
<!-- Hack to avoid flash of unstyled content in IE -->
<SCRIPT> </SCRIPT>
<META content=3D"MSHTML 6.00.6000.16587" name=3DGENERATOR></HEAD>
<BODY id=3Donecolumn>
<DIV id=3Dcontainer>
<DIV class=3Dwrapper>
<DIV id=3Dheader>
<DIV class=3Dwrapper>
<H1 id=3Dpage-title>
<DIV id=3Dg_title>LDPC Code</DIV></H1>
<DIV style=3D"CLEAR: both"></DIV>
<P class=3Ddescription>
<DIV id=3Dg_description>
<P><FONT face=3Dgeorgia size=3D4>Using MATLAB</FONT></P></DIV>
<P></P>
<DIV style=3D"CLEAR: both"></DIV></DIV></DIV><!-- /editable --><!-- =
/wrapper --><!-- /header -->
<DIV id=3Dmain-content>
<DIV class=3Dwrapper>
<DIV class=3D"content-item ">
<DIV id=3Dg_body>
<P></P>
<P><SPAN=20
style=3D"FONT-SIZE: 12pt; FONT-FAMILY: 'Times New Roman'; =
mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN-US; =
mso-fareast-language: EN-US; mso-bidi-language: AR-SA"><FONT=20
face=3Dverdana color=3D#000000><FONT size=3D2>This LDPC software is =
intended as an=20
introduction to LDPC codes computer based simulation.=20
The pseudo-random irregular low density parity check matrix is =
based=20
on Radford M. Neal=E2=80=99s programs collection, which can be found in =
[1]. <FONT=20
face=3Dverdana>While Neal=E2=80=99s collection is well =
documented, in my=20
opinion, C source codes are still overwhelming, especially if you =
are not=20
knowledgeable in C language. My software is written for MATLAB, which is =
more=20
readable than C. You may also want to refer to another MATLAB based LDPC =
source=20
codes in [2], which has different flavor of code-writing style (in fact =
Arun has=20
error in his log-likelihood decoder). =
</FONT></FONT></FONT></SPAN></P>
<P><FONT face=3Dgeorgia size=3D2><STRONG></STRONG></FONT> </P>
<P><FONT face=3Dgeorgia=20
size=3D2><STRONG>Creating LDPC matrix</STRONG></FONT></P>
<P><FONT face=3Dverdana size=3D2>Steps for creating LDPC matrix (from =
Neal's=20
website):</FONT></P>
<UL>
<LI><FONT face=3Dverdana size=3D2>Select one of the method for =
creating=20
sparse parity check matrix: (1) Evencol, or (2) Evenboth.</FONT>=20
<LI><FONT face=3Dverdana size=3D2>Add 1s to rows that have no 1s or =
only have one=20
1 in them.</FONT>=20
<LI><FONT size=3D2>If desired, try to avoid having cycle of =
lenght-four, where=20
pair of column, both have 1s in particular rows</FONT></LI></UL>
<P><FONT size=3D2>Evencol randomly distribute the same amount of 1s =
between=20
columns, evenboth is similar to evencol, but also try to make rows =
having the=20
same number of 1s.</FONT></P>
<P><FONT size=3D2>Function <FONT=20
face=3D"courier =
new,monospace"><STRONG>makeLdpc.m</STRONG></FONT> accepts 5=20
parameters:</FONT></P>
<UL>
<LI><FONT size=3D2>M: Number of=20
row </FONT>
<LI><FONT size=3D2>N: Number of column</FONT>=20
<LI><FONT size=3D2>method: Method for distributing 1s, 0 =3D Evencol, =
1 =3D=20
Evenboth</FONT>=20
<LI><FONT size=3D2>noCyle: Eliminate length-four cycle</FONT>=20
<LI><FONT size=3D2>onePerCol: Number of 1s per =
column.</FONT></LI></UL>
<P><FONT size=3D2>The output is M x N matrix parity check matrix=20
<STRONG>H</STRONG>. This function can only create R =3D 1/2 LDPC=20
matrix.</FONT></P>
<P><FONT face=3Dgeorgia size=3D2><STRONG></STRONG></FONT> </P>
<P><FONT face=3Dgeorgia size=3D2><STRONG>Generating parity check=20
bits</STRONG></FONT></P>
<P><FONT face=3Dverdana size=3D2>Parity check bits is =
computed using sparse LU=20
decomposition, utilizing sparse matrix properties of=20
<STRONG>H</STRONG>. Let <STRONG>H</STRONG> =3D=20
[<STRONG>A</STRONG>|<STRONG>B</STRONG>]. We need to decompose=20
<STRONG>A</STRONG> become <STRONG>LU</STRONG>, where =
<STRONG>L</STRONG> is=20
lower triangular and <STRONG>U</STRONG> is upper triangular. In order =
the=20
reduction to work, <STRONG>A</STRONG> must be non-singular, hence=20
<STRONG>A</STRONG> must be reordered to give 1s on the diagonal. Steps =
for=20
reordering <STRONG>A</STRONG> are (simplification from Neal's=20
website):</FONT></P>
<UL>
<LI><FONT size=3D2>Set <STRONG>L</STRONG> and <STRONG>U</STRONG> to =
all=20
zeros.</FONT>=20
<LI><FONT size=3D2>Set <STRONG>F</STRONG> to =
<STRONG>H</STRONG></FONT></LI></UL>
<P><FONT size=3D2> for i =3D 1 to M:</FONT></P>
<UL>
<LI><FONT size=3D2>Find non-zero element of <STRONG>F</STRONG> that is =
in row i=20
and column i, or in the latter column</FONT>=20
<LI><FONT size=3D2>Rearrange columns of <STRONG>F</STRONG> and=20
<STRONG>H</STRONG> from i onward to put this element in row i column =
i</FONT>=20
<LI><FONT size=3D2>Copy column i of <STRONG>F</STRONG> up to row i to =
column i=20
of <STRONG>U</STRONG></FONT>=20
<LI><FONT size=3D2>Copy column i of <STRONG>F</STRONG> from row i to =
colunm i of=20
<STRONG>L</STRONG></FONT>=20
<LI><FONT size=3D2>Add row i of <STRONG>F</STRONG> to later rows that =
have value=20
1 in column i.</FONT></LI></UL>
<P><FONT size=3D2> end</FONT></P>
<UL>
<LI><FONT size=3D2>Set <STRONG>B</STRONG> to the N - M column of the =
rearranged=20
<STRONG>H</STRONG>.</FONT></LI></UL>
<P><FONT size=3D2>There are 3 strategies to choose the next non-zero =
element for=20
the diagonal:</FONT></P>
<UL>
<LI><FONT size=3D2>First: choose the first found non-zero element from =
column i=20
onward from column search.</FONT>=20
<LI><FONT size=3D2>Mincol (minimal column): choose non-zero element =
from column=20
i onward that has minimum number of non-zeros in its column.</FONT>=20
<LI><FONT size=3D2>Minprod (minimal product): choose non-zero element =
from=20
column i onward that minimized the product of: (1) the number of =
non-zeros in=20
its row minus 1, and (2) the number of non-zeros in its column minus=20
1.</FONT></LI></UL>
<P><FONT size=3D2>Let <STRONG>z</STRONG> =3D <STRONG>Bs</STRONG>, where=20
<STRONG>s</STRONG> is binary input vector. Solve=20
<STRONG>L</STRONG>(<STRONG>Uc</STRONG>) =3D <STRONG>z</STRONG> for=20
<STRONG>c</STRONG>, where <STRONG>c</STRONG> is parity check vector. =
Provided=20
<STRONG>c</STRONG> is correct, let <STRONG>u</STRONG> =3D=20
[<STRONG>c</STRONG>|<STRONG>s</STRONG>]. We should have =
<STRONG>Hu'</STRONG> =3D=20
<STRONG>0</STRONG>, where <STRONG>H</STRONG> is rearranged=20
original <STRONG>H</STRONG>.</FONT></P>
<P><FONT size=3D2>Function <FONT=20
face=3D"courier new,monospace"><STRONG>makeParityChk.m</STRONG></FONT> =
accepts 3=20
parameters:</FONT></P>
<UL>
<LI><FONT size=3D2>dSource: Binary source</FONT>=20
<LI><FONT size=3D2>H: Parity check matrix (from makeLdpc.m)</FONT>=20
<LI><FONT size=3D2>strategy: Strategy for LU decomposition, 0=20
=3D First, 1 =3D Mincol, and 2 =
=3D Minprod,</FONT></LI></UL>
<P><FONT size=3D2>and the output will be: </FONT></P>
<UL>
<LI><FONT size=3D2>c: Parity check bits vector</FONT>=20
<LI><FONT size=3D2>newH: Rearrange H, which should be used for =
encoding-decoding=20
instead of original H.</FONT></LI></UL>
<P><FONT face=3Dgeorgia size=3D2><STRONG></STRONG></FONT> </P>
<P><FONT face=3Dgeorgia size=3D2><STRONG>Decoding</STRONG></FONT></P>
<P><FONT face=3Dverdana size=3D2>LDPC code decoding is done using =
iterative belief=20
propagation or sum-product algorithm (SPA). Four versions of SPA decoder =
(BPSK=20
modulated under AWGN channel) are presented:</FONT></P>
<UL>
<LI><FONT size=3D2>Hard-decision (bit-flip) decoder (<FONT=20
face=3D"courier =
new,monospace"><STRONG>decodeBitFlip.m</STRONG></FONT>)</FONT></LI></UL>
<P><FONT size=3D2>Decode 0/1 message, choose '1' if =
the majority is 1,=20
else '0'. The decoder could be used for tutorial or introduction to =
message=20
passing algorithms since it does not employ complicated probability =
or=20
log-likelihood function. Expect worse performance compared=20
to BPSK for very low E<FONT size=3D1>b</FONT>/N<FONT=20
size=3D1>0</FONT>.</FONT></P>
<UL>
<LI><FONT size=3D2>Probability-domain SPA decoder (<FONT=20
face=3D"courier =
new,monospace"><STRONG>decodeProbDomain.m</STRONG></FONT>)</FONT></LI></U=
L>
<P><FONT size=3D2>Based on Gallager's works [3]. </FONT></P>
<UL>
<LI><FONT size=3D2>Log-domain SPA decoder (<FONT=20
face=3D"courier =
new,monospace"><STRONG>decodeLogDomain.m</STRONG></FONT>)</FONT></LI></UL=
>
<P><FONT size=3D2>Similar to probability-domain SPA, but using =
log-likelihood=20
instead of probability function. The =
advantage is operations can=20
be done using additions instead of multiplications, which =
computationaly=20
less expensive.</FONT></P>
<UL>
<LI><FONT size=3D2>Simplified log-domain SPA decoder (<FONT=20
face=3D"courier =
new,monospace"><STRONG>decodeLogDomainSimple.m</STRONG></FONT>)</FONT></L=
I></UL>
<P><FONT size=3D2>A modified version of log-domain SPA, replaces Pi(x) =
with=20
minimum(x). For further simplification, log-likelihood function can =
be=20
replaced with incoming signal waveform directly [5], =
hence simplified=20
log-domain decoder does not need noise variance information.</FONT></P>
<P><FONT size=3D2></FONT> </P>
<P><FONT size=3D2>Both probability-domain and log-domain decoder need =
noise=20
variance (N<FONT size=3D1>0</FONT>/2) information for their input. Other =
decoder's paramaters include received noisy signal, H matrix and =
number of=20
iteration. </FONT></P>
<P> </P>
<P><FONT face=3Dgeorgia size=3D2><STRONG>Putting it all =
together</STRONG></FONT></P>
<P><FONT face=3Dverdana size=3D2>Download all the files below and run =
<FONT=20
face=3D"courier new,monospace"><STRONG>ldpcBer.m</STRONG></FONT>, you'll =
be good!=20
You might want to modify <FONT face=3D"courier =
new,monospace">ldpcBer.m</FONT>=20
first, running smaller size of LDPC matrix (i.e. smaller data =
frame)=20
or chose your prefered decoder. </FONT></P><FONT face=3Dgeorgia>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-FAMILY: Verdana"><?xml namespace prefix=3D"o" =
ns=3D"urn:schemas-microsoft-com:office:office"><O=20
p><FONT color=3D#000000 size=3D2> </FONT></O></SPAN></P>
<P>
<TABLE class=3DMsoTableGrid=20
style=3D"BORDER-RIGHT: medium none; BORDER-TOP: medium none; =
BORDER-LEFT: medium none; BORDER-BOTTOM: medium none; BORDER-COLLAPSE: =
collapse; mso-border-alt: solid windowtext .5pt; mso-yfti-tbllook: 480; =
mso-padding-alt: 0in 5.4pt 0in 5.4pt; mso-border-insideh: .5pt solid =
windowtext; mso-border-insidev: .5pt solid windowtext"=20
cellSpacing=3D0 cellPadding=3D0 border=3D1>
<TBODY>
<TR style=3D"mso-yfti-irow: 0; mso-yfti-firstrow: yes; =
mso-yfti-lastrow: yes">
<TD=20
style=3D"BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; =
BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: =
0in; BORDER-LEFT: windowtext 1pt solid; WIDTH: 239.4pt; PADDING-TOP: =
0in; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent; =
mso-border-alt: solid windowtext .5pt"=20
vAlign=3Dtop width=3D319>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -