




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)
文檔簡介
1、 2010 屆屆畢業(yè)畢業(yè)生生 畢業(yè)論畢業(yè)論文文題題 目:目: turboturbo 碼的編譯碼算法研究碼的編譯碼算法研究 院系名稱:院系名稱: 信息工程學(xué)院信息工程學(xué)院 專業(yè)班級:專業(yè)班級: 電子信息工程電子信息工程 學(xué)生姓名:學(xué)生姓名: 學(xué)學(xué) 號號: 指導(dǎo)教師:指導(dǎo)教師: 教師職稱:教師職稱: 教授教授 2010 年年 6 月月 2 日日摘摘 要要在現(xiàn)代數(shù)字通信系統(tǒng)中,信道編碼常用來保護(hù)系統(tǒng)免遭噪聲和外界干擾,并用于降低系統(tǒng)的比特誤碼率,提高系統(tǒng)的可靠性。turbo碼,由于性能接近香農(nóng)理論限,在低信噪比的應(yīng)用環(huán)境下比其他編碼好,因而在第三代移動通信系統(tǒng)多種方案中,考慮將turbo碼作為無線信
2、道的編碼標(biāo)準(zhǔn)之一。本文討論了turbo 碼的編譯碼基本原理,對turbo 碼的幾種常用的編譯碼算法進(jìn)行了分析,并在給出編譯碼器模型的基礎(chǔ)上,用matlab語言實現(xiàn)了整個系統(tǒng)的計算機(jī)仿真并給出參考設(shè)計程序。關(guān)鍵詞關(guān)鍵詞:遞歸系統(tǒng)卷積碼、turbo 碼、 軟判決viterbi 譯碼、交織器title: turbo code encoding and decoding algorithm abstractin modern digital communication systems, channel coding system used to protect against noise and in
3、terference, and used to reduce the systems bit error rate and improve system reliability. turbo code, as the performance approaches the shannon theoretical limit, the application of a low snr environment better than the other encodings, and thus the third generation mobile communication systems in a
4、 variety of programs, consider the turbo code as the wireless channel of the coding standard. this article discusses the basic principles of turbo codes encoding and decoding of turbo codes encoding and decoding of several commonly used algorithms are analyzed and presented codec based on the model,
5、 with the matlab language to implement the computer simulation of the system and to the reference design program.key words:recursive systematic convolutional code soft-decision viterbi decoding interleaver目目 次次1 引言.12 turbo 碼概述 .22.1 turbo碼簡介 .22.2 turbo碼的優(yōu)缺點 .22.3 turbo碼的發(fā)展 .33 turbo 碼的編碼原理 .43.1 編
6、碼器組成 .43.2 編碼原理 .63.3 編碼算法 .74 turbo 碼譯碼原理 .94.1譯碼器組成.94.2 譯碼原理.114.3 map(maximum a posteriori)算法.124.4log-map 算法和 max-log-map 算法 .144.5sova 算法.155 turbo 碼的性能仿真 .165.1 仿真軟件介紹 .165.2 仿真系統(tǒng)構(gòu)建 .185.3 編碼子系統(tǒng) .185.4 譯碼子系統(tǒng) .195.5 仿真結(jié)果與分析 .20結(jié) 論.24致 謝.25參考文獻(xiàn).26附 錄.271 1 引言引言在數(shù)字通信系統(tǒng)中,根據(jù)不同的目的,編碼可分為信源編碼和信道編碼。信源
7、編碼是為了提高數(shù)字信號的有效性以及為了使模擬信號數(shù)字化而采取的編碼。信道編碼是為了降低誤差率,提高數(shù)字通信的可靠性而采取的編碼。數(shù)字信號在傳輸過程中,加性噪聲、碼間串?dāng)_等都會生產(chǎn)誤碼。為了提高系統(tǒng)的抗干擾性能,可以加大發(fā)射功率,降低接受設(shè)備本身的噪聲,以及合理選擇調(diào)制、解調(diào)方法等。此外,還可以采用信道編碼技術(shù)。長期以來,編碼界一直致力于尋找編碼率接近香農(nóng)理論極限值、誤碼率小、解碼復(fù)雜度可以忍受的信道前向差錯控制編碼方法,提出了可重復(fù)解碼的編碼技術(shù),包括乘積碼、級聯(lián)碼、多級碼及其推廣。在重復(fù)解碼、軟入軟出解碼、遞歸系統(tǒng)卷積碼和非均勻交織等概念的基礎(chǔ)上,1993年c.berrou等在國際通信會議上
8、最先提出了turbo碼,它是并行級聯(lián)帶反饋系統(tǒng)卷積碼(parallel concatenation of recursivesystematic convolutional codes)的簡稱。仿真結(jié)果表明,在awgn 信道中,turbo 碼的糾錯性能接近香農(nóng)極限。從此turbo碼的研究成為了編碼界的一個研究熱點,并開始在各種通信系統(tǒng)中實現(xiàn)應(yīng)用。matlab將高性能的數(shù)值計算和可視化集成在一起,并提供了大量的內(nèi)置函數(shù),從而被廣泛地應(yīng)用于科學(xué)計算、控制系統(tǒng)、信息處理等領(lǐng)域的分析、仿真和設(shè)計工作,而且利用matlab產(chǎn)品的開放式結(jié)構(gòu),可以非常容易地對 matlab的功能進(jìn)行擴(kuò)充。matlab的數(shù)據(jù)
9、分析和處理功能十分強(qiáng)大,運(yùn)用它來進(jìn)行語音信號的分析、處理和可視化相當(dāng)便捷,simulink是matlab提供的動態(tài)仿真工具,它采用模塊組合的方法來創(chuàng)建動態(tài)系統(tǒng)的計算機(jī)模型,其最突出的特點就是它的開放性,用戶可以通過s一函數(shù)定制自己的模塊和模塊庫,本文本文首先介紹了turbo碼編譯碼的基本原理以及研究較深的幾種算法,在這個基礎(chǔ)上使用matlab建立仿真模型,最后給出仿真結(jié)果。2 2 turboturbo 碼概述碼概述2.12.1 turboturbo 碼簡介碼簡介著名的shannon信道編碼定理指出,每一信道都有一定的信道容量c,對任何rc的傳信率,都存在有速率為r的碼,用最大似然(ml)譯碼可
10、達(dá)到任意小的錯誤概率p。該定理包含兩方面的含義:一是shannon用隨機(jī)編碼方式證明,當(dāng)rc時,若n趨近于無窮,則使p趨近于0的好碼是存在的;二是為了達(dá)到理論值,應(yīng)該利用最大似然譯碼。turbo碼由兩個二元卷積碼并行級聯(lián)而成。turbo碼編譯碼器采用流水線結(jié)構(gòu),其編譯碼基本思想是,采用軟輸入/軟輸出(siso)的迭代譯碼算法,編碼時將短碼構(gòu)成長碼,譯碼時再將長碼轉(zhuǎn)為短碼。譯碼算法的特點是,利用兩個子譯碼器之間信息的往復(fù)迭代遞歸調(diào)用,加強(qiáng)后驗概率對數(shù)似然比,從而提高判決可靠性,turbo碼由此而得名,這種算法也被稱為最大后驗概率(map)算法。由于turbo碼很好地應(yīng)用了shannon信道編碼定
11、理中的隨機(jī)性編譯碼條件,從而獲得幾乎接近shannon理論極限的譯碼性能。2.22.2 turboturbo 碼的優(yōu)缺點碼的優(yōu)缺點turbo碼可以在譯碼復(fù)雜性與碼率之間達(dá)到較好的平衡,而且在中高噪聲的應(yīng)用環(huán)境中,性能比以往其它信道編碼好很多。通過數(shù)值模擬表明,在awgn 信道下,碼率為1/2 的turbo碼在達(dá)到誤比特率(ber) 10-5時,信噪比僅為約0.7db。(這種情況下達(dá)到信道容量的理想信噪比值為0db),遠(yuǎn)遠(yuǎn)超過了其他的編碼方式。其主要的不足之處是:(1)計算量大,要得到高碼率往往需要很大的交織器;(2)由交織和交錯譯碼造成的時延,使turbo碼在某些對時延要求高的通信系統(tǒng)中的應(yīng)用
12、受到限制;(3)理論分析困難,至今對于turbo碼的譯碼復(fù)雜性、比特誤碼率,尚未形成完整的理論分析和估計。2.32.3 turboturbo 碼的發(fā)展碼的發(fā)展對turbo碼的研究進(jìn)展大體有三個方面:(1)主要涉及到turbo碼理論的研究。大多數(shù)研究集中在算法的改進(jìn),包括分量碼的選擇,交織器的設(shè)計,譯碼算法的改進(jìn),終止技術(shù)等turbo碼的各個環(huán)節(jié),取得了大量的成果,為turbo碼的實現(xiàn)和在其它領(lǐng)域的應(yīng)用打下了堅實的基礎(chǔ)。(2)隨著turbo碼技術(shù)的成熟,最新研究大多集中在turbo碼和其它技術(shù)結(jié)合的應(yīng)用上,并且取得了很大的進(jìn)展。如turbo碼和其它糾錯碼的級聯(lián),turbo碼和調(diào)制技術(shù)的結(jié)合(即t
13、tcm技術(shù)),turbo碼均衡技術(shù),turbo碼多用戶檢測技術(shù)等。(3)由于turbo碼時延問題的限制,應(yīng)用最先集中在對時延不敏感的場合,如衛(wèi)星通信和一些非實時的場合。隨著硬件技術(shù)的發(fā)展,turbo碼在實時領(lǐng)域的應(yīng)用成為可能,值得一提的是turbo碼已經(jīng)成為3g方案中高速數(shù)據(jù)的糾錯技術(shù)之一,可見其應(yīng)用的潛力是很大的。但turbo碼在衰落信道中的應(yīng)用還有很多問題需要解決,是目前研究的熱點。turbo碼理論的出現(xiàn)是信道編譯碼史上的一個里程碑。它可以相當(dāng)接近信道容量的極限,在高速效據(jù)傳遞中有著傳統(tǒng)碼無可比擬的優(yōu)勢,以其優(yōu)良的性能引起了廣泛的重視。目前turbo碼技術(shù)已經(jīng)從理論研究和仿真實驗開始走向應(yīng)
14、用,其許多關(guān)鍵的技術(shù)已經(jīng)有了多種改進(jìn)的方案,使其性能更加提高,更有利于軟件和硬件的實現(xiàn)。turbo碼和其它技術(shù)的結(jié)合以及在其它領(lǐng)域的應(yīng)用也是最近研究的熱點,并取得了大量的成果。相信隨著軟件和硬件技術(shù)的發(fā)展,turbo碼技術(shù)的時延和算法復(fù)雜性等問題會得到極大地改善,并逐步取代業(yè)已成熟的分組碼和卷積碼技術(shù),而且還會進(jìn)一步與其它的技術(shù)結(jié)合,廣泛應(yīng)用于數(shù)字通信的各個領(lǐng)域。3 3 turboturbo 碼的編碼原理碼的編碼原理 3.13.1 編碼器組成編碼器組成(1) 編碼器結(jié)構(gòu)turbo 碼的基本思想是利用短碼構(gòu)造等效長度意義上的長碼。turbo 碼編碼器是由兩個反饋的系統(tǒng)卷積碼編碼器通過一個偽隨機(jī)交
15、織器并行連接而成的,編碼后的校驗位經(jīng)過刪余陣,可以產(chǎn)生不同碼率的碼字。一個典型的 turbo 碼編碼器如圖所示。圖 3-1 編碼器結(jié)構(gòu)圖編碼是通過兩個相同的編碼器和一個交織器組成。第一個編碼器直接對信源信息序列進(jìn)行編碼,第二個編碼器則對經(jīng)過交織器后的信息序列進(jìn)行編碼,交織器對輸入的原信息序列進(jìn)行隨機(jī)交織后輸出。在編碼過程中,信息序列u=u1,u2.un經(jīng)過個n位交織器,形成個新序列ui (長度與內(nèi)容沒變,但比特位置經(jīng)過重新排列)。u與ui分別經(jīng)由兩個相同結(jié)構(gòu)的子編碼器(分量碼編碼器)編碼,生成序列x1,x2。x1,x2再與未編碼的序列經(jīng)過復(fù)用,即生成turbo碼序列x。在實際應(yīng)用中,為了提高t
16、urbo碼的碼率,經(jīng)常增加一個刪余過程,對校驗序列x1,x2進(jìn)行刪余,周期的刪除一些校驗位,形成新的校驗序列,再與未編碼序列經(jīng)過復(fù)用調(diào)制后,生成turbo碼序列x。(2) 子編碼器子編碼器(component encoder)也叫分量碼編碼器。一般一個 turbo 碼編碼器由兩個(可以多個)子編碼器和通過交織器的作用并行級聯(lián)組成。子編1c2c碼器的結(jié)構(gòu)可以不同,但一般取相同結(jié)構(gòu),以簡化譯碼。子碼可以是卷積碼或者是分組碼,而同時 turbo 碼中級聯(lián)的兩個子編碼器必須是系統(tǒng)碼,所以一般選擇遞歸系統(tǒng)卷積碼(rsc) 。(3) rsc 碼rsc 碼是與 turbo 碼同時提出的一類新的遞歸型系統(tǒng)卷積
17、碼,該碼在高碼率時比最好的 nsc(非系統(tǒng)卷積碼)還要好。turbo 碼既然要求采用系統(tǒng)碼,理所當(dāng)然就選上了遞歸型系統(tǒng)卷積碼 rsc。rsc 與 nsc 的狀態(tài)轉(zhuǎn)移圖對比如下圖:圖 3-2 rsc 與 nsc 的狀態(tài)轉(zhuǎn)移圖(4) 交織器交織器在 turbo 碼編碼中的主要作用是減少校驗比特間的相關(guān)性,進(jìn)而在迭代譯碼過程中降低誤比特。其基本的原則是:通過增加交織器的長度,可使譯碼性能得到提高,交織器應(yīng)該使輸入序列盡能地隨機(jī)化,從而避免編碼生成碼字的信息序列交織后,編碼仍舊生成低重碼字,導(dǎo)致 turbo 碼的自由距離減少。交織器有多種,本文中采用了偽隨機(jī)交織器模塊,偽隨機(jī)交織器反映的實際上是一種映
18、射關(guān)系。其工作過程是:對于長為 n 的信息序列,首先標(biāo)記每個比特的位置,然后生成 n 個0,1之間的隨機(jī)數(shù),按產(chǎn)生的順序排列成序列 x,每個隨機(jī)數(shù)都對應(yīng)于信息序列中的信息比特。然后把 x 中元素按一定的規(guī)則重新排列得到新的序列 y,并按 y 中元素的順序讀出相應(yīng)的信息比特,這樣就完成了交織。比如隨機(jī)序列0.7621 0.4565 0.0185 0.8214 0.4447,它對應(yīng)信息序列 x 為 。將隨機(jī)序列按升序排列得到0.0185 1d2d3d4d5d0.4447 0.4565 0.7621 0.8214,則現(xiàn)在對應(yīng)的信息序列 y 為 3d5d2d 。這樣,就完成了交織。1d4d3.23.2
19、 編碼原理編碼原理如果一個碼率為的卷積碼的生成矩陣為:n/1 (式 3-1)().()()(110dgdgdgdgn則其對應(yīng)的遞歸系統(tǒng)卷積碼的生成矩陣為: (式 3-2)()(.)()(1()(0101dgdgdgdgdgnsys如以生成矩陣為(也可以表示為 g1 1 0 )111 ()(332ddddddgsys1;1 1 1 1)的遞歸系統(tǒng)卷積碼作為子碼,它對應(yīng)的 turbo 碼的編碼結(jié)構(gòu)如圖:圖 3-3 turbo 碼的編碼結(jié)構(gòu)圖輸入編碼器的信息序列為,它一方面直接輸入到進(jìn)行編),.,(21kuuuu 1c碼,生成系統(tǒng)序列和校驗序列,另一方面,u 經(jīng)過交織器后,輸入到中sxpx12c進(jìn)行
20、編碼,產(chǎn)生另一個校驗序列,這三個序列經(jīng)復(fù)用單元復(fù)用后完成編碼,px2得到發(fā)送序列。復(fù)用單元的作用是調(diào)整編碼速率,并將并行數(shù)據(jù)變換為串行數(shù)y據(jù)流。通常系統(tǒng)序列全部傳送,校驗序列按照收縮矩陣收縮。圖示 turbo 碼編碼器可以采用收縮矩陣將編碼速率調(diào)整到 1/2,矩陣的每行對應(yīng)一1001pp個子編碼器,第一列和第二列分別對應(yīng)子編碼器輸出的第偶數(shù)個碼元和第奇數(shù)個碼元。1 表示該碼元需要傳送,0 表示不需傳送。如果稱對原始信息序列編碼為水平方向的編碼,稱對經(jīng)過交織器后的信c息序列編碼為垂直方向的編碼。在每個方向上,個信息比特經(jīng)過編碼器輸ck出為 (式 3-3).,.(,1kkxxxx 其中,或 tnk
21、kktnkkkkppuxxx),.,(),.,(1,1 ,2,1 ,xcxcx表示信息比特,表示與該信息比特對應(yīng)的校驗比特,校驗比特數(shù)取kuvkp,決于系統(tǒng)卷積碼的生成多項式。顯然 (式 3-4)nvkkkpxvkvk2,1,211,傳輸前經(jīng)過收縮,有一部分校驗比特將不予傳送,在接收端未被傳送的比特位用零填充。從上面的介紹我們可以看到,turbo 碼編碼部分級聯(lián)結(jié)構(gòu)和交織器的共同作用,使 turbo 編碼接近隨機(jī)編碼,從而保證了 turbo 碼必定是一種好碼。3.33.3 編碼算法編碼算法首先談一下對生成多項式 g 的理解。 圖 3-4 遞歸系統(tǒng)碼對照遞歸系統(tǒng)卷積碼的一般的編碼結(jié)構(gòu)圖 3-4。
22、若,其中,21iiggg 1,m+1(其中 m 是寄存器的數(shù)目) 。是矩陣 g 的第一行,可以看成是對iig1應(yīng)的圖 3-4 中的反饋環(huán)支路;是矩陣 g 的第二行,可以看成對應(yīng)的是輸出ig2的支路。和分別對應(yīng)兩點的信息。無論還是中的后 mky11g21gkkad 和ig1ig2個信息位的每一位都分別對應(yīng)一個寄存器。它們可以看成是標(biāo)志著一種狀態(tài)。第一行中的后 m 位表示產(chǎn)生反饋信息所用到的寄存器,比如說第 j1 位,ig1它對應(yīng)于第 j 個寄存器,該位為 1 表示用到了該寄存器內(nèi)的信息,即該寄存器有反饋到輸出信息的那個加法器,為零則表示沒有反饋回去。同理,中kaig2的后 m 位表示產(chǎn)生信息所用
23、到的寄存器。ky算法流程如下:(1) 對于 encoder1:dinput ;l_info=length(d) ;l_total=l_info + m ;goto (3) ;y(1,:)x ;y (2,:) y ;(2)對于 encoder2:dy(1,:) (alpha) ;alpha 為偽隨機(jī)交織圖樣(是 l_total 列行向量)l_totallength(d) ;l_infol_total ;goto (3) ;y (3,:) y ;goto (4) 。(3) state 為一 m 列行向量。初始化為零 if l_info,k;kxkd elseif l_info 0 % unpunc
24、tured for i = 1:l_total for j = 1:3 en_output(1,3*(i-1)+j) = y(j,i); end endelse % punctured into rate 1/2 for i=1:l_total en_output(1,n*(i-1)+1) = y(1,i); if rem(i,2) % odd check bits from rsc1 en_output(1,n*i) = y(2,i); else % even check bits from rsc2 en_output(1,n*i) = y(3,i); end end end % anti
25、podal modulation: +1/-1en_output = 2 * en_output - ones(size(en_output); function y = rsc_encode(g, x, terminated)% encodes a block of data x (0/1)with a recursive systematic% convolutional code with generator vectors in g, and% returns the output in y (0/1).% if terminated0, the trellis is perfectl
26、y terminated% if terminated0 l_info = length(x); l_total = l_info + m;else l_total = length(x); l_info = l_total - m;end % initialize the state vectorstate = zeros(1,m); % generate the codewordfor i = 1:l_total if terminated0 & i0 & il_info % terminate the trellis d_k = rem( g(1,2:k)*state,
27、2 ); end a_k = rem( g(1,:)*d_k state, 2 ); output_bits, state = encode_bit(g, a_k, state); % since systematic, first output is input bit output_bits(1,1) = d_k; y(n*(i-1)+1:n*i) = output_bits;endfunction output, state = encode_bit(g, input, state)% this function takes as an input a single bit to be
28、encoded,% as well as the coeficients of the generator polynomials and% the current state vector.% it returns as output n encoded data bits, where 1/n is the% code rate. % the rate is 1/n% k is the constraint length% m is the amount of memoryn,k = size(g);m = k-1; % determine the next output bitfor i
29、=1:n output(i) = g(i,1)*input; for j = 2:k output(i) = xor(output(i),g(i,j)*state(j-1); end;end state = input, state(1:m-1);function l_all = logmapo(rec_s,g,l_a,ind_dec)% log_map algorithm using straightforward method to compute branch metrics% no approximation is used.% can be simplified to max-log
30、-map by using approximation ln(ex+ey) = max(x,y).% input: rec_s: scaled received bits. % rec_s = 0.5 * l_c * yk = ( 2 * a * rate * eb/n0 ) * yk% g: code generator for the component rsc code, in binary matrix form.% l_a: a priori info. for the current decoder, % scrambled version of extrinsic inftyo.
31、 of the previous decoder.% ind_dec: index of decoder. either 1 or 2. % encoder 1 is assumed to be terminated, while encoder 2 is open.% output: l_all: log-likelihood ratio of the symbols. complete information. % total number of bits: inftyo. + taill_total = length(rec_s)/2;n,k = size(g); m = k - 1;n
32、states = 2m; % number of states in the trellis % set up the trellisnext_out, next_state, last_out, last_state = trellis(g); infty = 1e10; % initialization of alphaalpha(1,1) = 0; alpha(1,2:nstates) = -infty*ones(1,nstates-1); % initialization of betaif ind_dec=1 beta(l_total,1) = 0; beta(l_total,2:n
33、states) = -infty*ones(1,nstates-1); elseif ind_dec=2 beta(l_total,1:nstates) = zeros(1,nstates);else fprintf(ind_dec is limited to 1 and 2!n);end % trace forward, compute alphafor k = 2:l_total+1 for state2 = 1:nstates gamma = -infty*ones(1,nstates); gamma(last_state(state2,1) = (-rec_s(2*k-3)+rec_s
34、(2*k-2)*last_out(state2,2). -log(1+exp(l_a(k-1); gamma(last_state(state2,2) = (rec_s(2*k-3)+rec_s(2*k-2)*last_out(state2,4). +l_a(k-1)-log(1+exp(l_a(k-1); if(sum(exp(gamma+alpha(k-1,:)1e-300) alpha(k,state2)=-infty; else alpha(k,state2) = log( sum( exp( gamma+alpha(k-1,:) ) ) ); end end tempmax(k) =
35、 max(alpha(k,:); alpha(k,:) = alpha(k,:) - tempmax(k);end % trace backward, compute betafor k = l_total-1:-1:1 for state1 = 1:nstates gamma = -infty*ones(1,nstates); gamma(next_state(state1,1) = (-rec_s(2*k+1)+rec_s(2*k+2)*next_out(state1,2). -log(1+exp(l_a(k+1); gamma(next_state(state1,2) = (rec_s(
36、2*k+1)+rec_s(2*k+2)*next_out(state1,4). +l_a(k+1)-log(1+exp(l_a(k+1); if(sum(exp(gamma+beta(k+1,:)mk1 path_metric(state,t+1)=mk0; mdiff(state,t+1) = mk0 - mk1; prev_bit(state, t+1) = 0; else path_metric(state,t+1)=mk1; mdiff(state,t+1) = mk1 - mk0; prev_bit(state,t+1) = 1; end endend % for decoder 1
37、, trace back from all zero state, % for decoder two, trace back from the most likely stateif ind_dec = 1 mlstate(l_total+1) = 1;else mlstate(l_total+1) = find( path_metric(:,l_total+1)=max(path_metric(:,l_total+1) );end % trace back to get the estimated bits, and the most likely pathfor t=l_total:-1
38、:1 est(t) = prev_bit(mlstate(t+1),t+1); mlstate(t) = last_state(mlstate(t+1), est(t)+1);end % find the minimum delta that corresponds to a compitition path with different info. bit estimation. % give the soft outputfor t=1:l_total llr = infty; for i=0:delta if t+il_total+1 bit = 1-est(t+i); temp_sta
39、te = last_state(mlstate(t+i+1), bit+1); for j=i-1:-1:0 bit = prev_bit(temp_state,t+j+1); temp_state = last_state(temp_state, bit+1); end if bit=est(t) llr = min( llr,mdiff(mlstate(t+i+1), t+i+1) ); end end end l_all(t) = (2*est(t) - 1) * llr;end function l_all = mapo(rec_s,g,l_a,ind_dec)% map algori
40、thm using straightforward method to compute branch metrics% no approximation is used.% can be simplified to max-log-map by using approximation ln(ex+ey) = max(x,y).% input: rec_s: scaled received bits. % rec_s = 0.5 * l_c * yk = ( 2 * a * rate * eb/n0 ) * yk% g: code generator for the component rsc
41、code, in binary matrix form.% l_a: a priori info. for the current decoder, % scrambled version of extrinsic inftyo. of the previous decoder.% ind_dec: index of decoder. either 1 or 2. % encoder 1 is assumed to be terminated, while encoder 2 is open.% output: l_all: log-likelihood ratio of the symbol
42、s. complete information. l_c=2;% total number of bits: inftyo. + taill_total = length(rec_s)/2;n,k = size(g); m = k - 1;nstates = 2m; % number of states in the trellis % set up the trellisnext_out, next_state, last_out, last_state = trellis(g); % initialization of alphaalpha(1,1) = 1; alpha(1,2:nsta
43、tes) = zeros(1,nstates-1);% initialization of betaind_dec=1;if ind_dec=1 beta(l_total,1) = 1; beta(l_total,2:nstates) = zeros(1,nstates-1); elseif ind_dec=2 beta(l_total,1:nstates) = zeros(1,nstates);else fprintf(ind_dec is limited to 1 and 2!n);end% trace forward, compute alpha% trace forward, comp
44、ute alphafor k = 2:l_total+1 for state2 = 1:nstates gamma = zeros(1,nstates); gamma(last_state(state2,1) = (1/(1+exp(l_a(k-1)*exp(-rec_s(2*k-3)+rec_s(2*k-2)*last_out(state2,2);%uk=+1 gamma(last_state(state2,2) = (exp(l_a(k-1)/(1+exp(l_a(k-1)*exp(rec_s(2*k-3)+rec_s(2*k-2)*last_out(state2,4);%uk=-1 al
45、pha(k,state2) = sum(gamma.*alpha(k-1,:); end normlizesum(k)=sum(alpha(k,:); alpha(k,:)=alpha(k,:)/normlizesum(k);end% trace backward, compute betafor k = l_total-1:-1:1 for state1 = 1:nstates gamma = zeros(1,nstates); gamma(next_state(state1,1) = (1/(1+exp(l_a(k+1)*exp(-rec_s(2*k+1)+rec_s(2*k+2)*nex
46、t_out(state1,2); gamma(next_state(state1,2) = (exp(l_a(k+1)/(1+exp(l_a(k+1)*exp(rec_s(2*k+1)+rec_s(2*k+2)*next_out(state1,4); beta(k,state1) = sum(gamma.*beta(k+1,:); end beta(k,:)=beta(k,:)/normlizesum(k+1);end% compute the soft output, log-likelihood ratio of symbols in the framefor k = 1:l_total
47、for state2 = 1:nstates gamma0 = exp(-rec_s(2*k-1)+rec_s(2*k)*last_out(state2,2)/(1+exp(l_a(k); gamma1 = exp(rec_s(2*k-1)+rec_s(2*k)*last_out(state2,4)*exp(l_a(k)/(1+exp(l_a(k); temp0(state2) = (gamma0 * alpha(k,last_state(state2,1) * beta(k,state2); temp1(state2) = (gamma1 * alpha(k,last_state(state
48、2,2) * beta(k,state2); end l_all(k) = log(sum(temp1) - log(sum(temp0);end % this script simulates the classical turbo encoding-decoding system. % it simulates parallel concatenated convolutional codes.% two component rate 1/2 rsc (recursive systematic convolutional) component encoders are assumed.%
49、first encoder is terminated with tails bits. (info + tail) bits are scrambled and passed to % the second encoder, while second encoder is left open without tail bits of itself.% random information bits are modulated into +1/-1, and transmitted through a awgn channel.% interleavers are randomly gener
50、ated for each frame.% log-map algorithm without quantization or approximation is used.% by making use of ln(ex+ey) = max(x,y) + ln(1+e(-abs(x-y),% the log-map can be simplified with a look-up table for the correction function.% if use approximation ln(ex+ey) = max(x,y), it becomes max-log-map.% clea
51、r all % write display messages to a text filediary turbo_logmap.txt % choose decoding algorithm dec_alg = input( please enter the decoding algorithm. (0:log-map, 1:sova) default 0 );if isempty(dec_alg) dec_alg = 0;end % frame sizel_total = input( please enter the frame size (= info + tail, default:
52、400) );if isempty(l_total) l_total = 400; % infomation bits plus tail bitsend % code generatorg = input( please enter code generator: ( default: g = 1 1 1; 1 0 1 ) );if isempty(g) g = 1 1 1; 1 0 1 ;end%g = 1 1 0 1; 1 1 1 1;%g = 1 1 1 1 1; 1 0 0 0 1; n,k = size(g); m = k - 1;nstates = 2m; %puncture =
53、 0, puncturing into rate 1/2; %puncture = 1, no puncturingpuncture = input( please choose punctured / unpunctured (0/1): default 0 );if isempty(puncture) puncture = 0;end % code raterate = 1/(2+puncture); % fading amplitude; a=1 in awgn channela = 1; % number of iterationsniter = input( please enter
54、 number of iterations for each frame: default 5 );if isempty(niter) niter = 5;end % number of frame errors to count as a stop criteriorferrlim = input( please enter number of frame errors to terminate: default 15 );if isempty(ferrlim) ferrlim = 15;end ebn0db = input( please enter eb/n0 in db : default 2.0 );if isempty(ebn0db) ebn0db = 2.0;end fprintf(nn-n); if dec_alg = 0 fprintf( = log-map decoder = n);else fprintf( = sova decoder = n);endfprintf( frame size = %
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 湖南三一工業(yè)職業(yè)技術(shù)學(xué)院《普通物理二》2023-2024學(xué)年第二學(xué)期期末試卷
- 漳州科技職業(yè)學(xué)院《男裝設(shè)計》2023-2024學(xué)年第二學(xué)期期末試卷
- 攀枝花學(xué)院《工程圖學(xué)與計算機(jī)繪圖甲》2023-2024學(xué)年第二學(xué)期期末試卷
- 15《搭船的鳥》教學(xué)設(shè)計-2024-2025學(xué)年三年級上冊語文統(tǒng)編版
- 金山職業(yè)技術(shù)學(xué)院《外貿(mào)專業(yè)英語一》2023-2024學(xué)年第二學(xué)期期末試卷
- 信陽師范大學(xué)《工程實訓(xùn)》2023-2024學(xué)年第二學(xué)期期末試卷
- 銅仁幼兒師范高等專科學(xué)?!度肆Y源管理沙盤模擬》2023-2024學(xué)年第二學(xué)期期末試卷
- 船舶運(yùn)力合同范本
- 第 19課《燈泡亮了》教學(xué)設(shè)計-2023-2024學(xué)年青島版科學(xué)四年級下冊
- 《7 比較測量紙帶和尺子》教學(xué)設(shè)計-2023-2024學(xué)年一年級上冊科學(xué)教科版
- 汽車行業(yè)維修記錄管理制度
- 公務(wù)員2022年國考申論試題(行政執(zhí)法卷)及參考答案
- IQC檢驗作業(yè)指導(dǎo)書
- 城市自來水廠課程設(shè)計
- 重慶市2024年小升初語文模擬考試試卷(含答案)
- 2024智慧城市數(shù)據(jù)采集標(biāo)準(zhǔn)規(guī)范
- 【人教版】《勞動教育》七上 勞動項目一 疏通廚房下水管道 課件
- 2024特斯拉的自動駕駛系統(tǒng)FSD發(fā)展歷程、技術(shù)原理及未來展望分析報告
- 2024-2030年中國銀行人工智能行業(yè)市場深度調(diào)研及發(fā)展趨勢與投資前景研究報告
- 五屆全國智能制造應(yīng)用技術(shù)技能大賽數(shù)字孿生應(yīng)用技術(shù)員(智能制造控制技術(shù)方向)賽項實操樣題
- 中國銀行中銀數(shù)字服務(wù)(南寧)有限公司招聘筆試真題2023
評論
0/150
提交評論