資源簡介
這個程序詳細(xì)解釋了VITERBI程序的流程和結(jié)果,對GSM\CDMA信號卷積譯碼提供參考
代碼片段和文件信息
c1=[1?1?1];
c2=[1?0?1];
%生成轉(zhuǎn)移碼表和輸出碼表
%設(shè)轉(zhuǎn)移碼表是state_shift(28);其中state_shift(11)與state_shift(21)表示在狀態(tài)S1下輸入0和1的轉(zhuǎn)移
%矩陣。state設(shè)置為1?2?3?4?5?6?7?8(3個寄存器);
%設(shè)當(dāng)前狀態(tài)是K,那么輸入0的下一狀態(tài)是:reg(bitshift-1)輸入1的下一狀態(tài)是reg(bitshift-1)+2^2;
%于是轉(zhuǎn)移狀態(tài)矩陣是:
temp=0;
for?i=1:8;
????state_shift(1i)=bitshift((i-1)-1)+1;
????y=deci2bin(i-131);
????temp=y(11);
????for?j=2:3;
???????temp=xor(tempy(1j));
????end?
????state_out(1i)=temp;
????temp=y(11);
????state_out(2i)=xor(tempy(13));
????state_shift(2i)=bitshift((i-1)-1)+5;
end
%????????????1?????2?????3?????4?????5?????6?????7?????8
%???????????1??5??1??5??2?6???2?6???3??7??3??7??4?8???4?8
%輸出:?????0??0??1??1??1?0???0??1??1??1??0??0??0??1??1??0
%?前一狀態(tài)??1??2??3??4??5?6???7??8??1?2??3??4??5??6???7??8
%那么已知當(dāng)前狀態(tài)K,求其前一狀態(tài)是:去搜索state_out(1,i)與state_out(2,i)看其等于幾。
%計算狀態(tài)轉(zhuǎn)移輸入矩陣。
cnt=1;
?for?k=1:8;
????for?i=1:8;
???????for?j=1:2;
???????????if?state_shift(ji)==k;
???????????????state_ad(cntk)=i;
???????????????cnt=cnt+1;
???????????????if?cnt==3;
???????????????????cnt=1;
???????????????end
???????????end
???????end
????end?
?end?
?%假設(shè)輸出是[11?01?01?11?11?01]
%?t0時刻:
receive=[1?1?1?0?1?1?1?1?1?0?1?1];
weight(11:8)=0;
%?t1?時刻?weight1(11:8)=[2?0?1?1?0?2?1?1]
%?t2時刻??weight2(11:8)=[1?1?2?0?1?1?0?2],
%而這這個時刻,假設(shè)每種狀態(tài)都可能由上兩種狀態(tài)轉(zhuǎn)移而來。設(shè)為weight_ad(1K)與weight_ad(2K);
%那么weight_ad(11)=在T1時刻weight1(1state_ad(11));weight_ad(21)=weight1(1st
%ate_ad(21));同樣得到weight_ad(1,1:8)與weight_ad(2,1:8);
%比較weight_ad(1:)與weight_
評論
共有 條評論