資源簡介
這個程序詳細解釋了VITERBI程序的流程和結果,對GSM\CDMA信號卷積譯碼提供參考
代碼片段和文件信息
c1=[1?1?1];
c2=[1?0?1];
%生成轉移碼表和輸出碼表
%設轉移碼表是state_shift(28);其中state_shift(11)與state_shift(21)表示在狀態S1下輸入0和1的轉移
%矩陣。state設置為1?2?3?4?5?6?7?8(3個寄存器);
%設當前狀態是K,那么輸入0的下一狀態是:reg(bitshift-1)輸入1的下一狀態是reg(bitshift-1)+2^2;
%于是轉移狀態矩陣是:
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
%?前一狀態??1??2??3??4??5?6???7??8??1?2??3??4??5??6???7??8
%那么已知當前狀態K,求其前一狀態是:去搜索state_out(1,i)與state_out(2,i)看其等于幾。
%計算狀態轉移輸入矩陣。
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?
?%假設輸出是[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],
%而這這個時刻,假設每種狀態都可能由上兩種狀態轉移而來。設為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_
- 上一篇:LMS 自適應濾波的 C 語言源代碼
- 下一篇:關于五三整數小波變換wavlet
評論
共有 條評論