[問題] 請大家我看ㄧ下哪邊有錯 ~convolution code已回收

看板MATLAB作者 (Azuro)時間15年前 (2009/01/07 22:58), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
最近在寫有關迴旋編碼 和威特比解碼的式子 clc ; clear ; close ; g = [1 1 1;1 0 1] ; %轉移函數 [n,K] = size(g) ; m = K-1 ; %暫存器的數目 state = zeros(1,m) ; %設定暫存器的狀態為0 inputx = [0 1 0 1 1 1 0 0 1 0 1 0 0 0 1] ; [trash,h] = size(inputx) ; outputy = [] ; for x= 1 : h %number of input bits input = inputx(1,x) ; for i = 1 : n output(i) = g(i,1)*input ; for j = 2:K z = g(i,j)*state(j-1) ; output(i) = xor(output(i),z); end end state = [input , state(1:m-1)] ; outputy = [outputy,output] ; %new elemant added to sequence end outputy % final encoder output in command window 我想問說這樣寫對嗎 我的RATE是1/2 另1個問題則是如何改成RATE的比率可以調整呢? 非常感謝~~~~~ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 203.72.84.193
文章代碼(AID): #19PCCSYN (MATLAB)