资源描述:
《卷积码的维特比译码函数》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、卷积码的维特比译码函数Function[decoder_output,survivor_state,cumulatedmetric]二viterbi(G,k,channeloutput)Thevictoroftheconvolutioncode%VITERBIconvolvedwiththewittbydecoder[decoderouput,survivorstate,cumulatedmetric]=viterbi(G,k,charmel_output)%GisannbyLkmatrix,andeachrowofthe
2、matrixistrue%fixedthecormectionbetweentheshifterrorandthenoutput,%isthecoderate・The%survivorstateisthematrixthatrepresentsthebestpaththroughthenetwork.The%measurementisgiveninanotherfunction,metric(x,y),andcanbebasedonThe%hardjudgmentandsoftjudgmentarespecified.%t
3、hisalgorithmminimizesmetricsratherthanmaximizeslikelihoodN=size(G,1);Theone-dimensionalsizeofthematrixG,whichistheoutputport%checksizeIfrem(size(G,2),k)~=0percentwhentheGcolumnisnotintegertimeskError('SizeofGandkdonotagree')%sendstheerrormessageTheendIfrem(channel
4、_output,2),n)~二0%whenthenumberofoutputelementsisnotintegertimestheoutputportErrorCChanneloutputnotoftherightsize')%sendstheerrormessageTheendL二size(G,2)/k;The%drawstheshiftnumber,thenumberofregisters%becauseofthestateoftheL-1register,theoutputstatuscanbeexpressed,
5、SothetotalnumberofstatesnumberofstatescanbefromthefirstL-1Thestatuscombinationofthe%registerisdeterminedNumberofstates=2((L-1)*k);The%generatesthestatetransfermatrix,theoutputmatrix,andtheinputmatrixForj=0:numberofstates-1%jrepresentsthestatusofthecurrentregisterg
6、roupbecausethestatusisfromzeroThe%start,sotheloopgoesfrom0tonumber_of_statesTFor1二0-2八1fromkk-1%attheinputsignalofthestate,theoverallshape%numbetis2k,sothecyclefrom0to2k-11%nxt_statcompletesastateoftheregistergroupfromthecurrentstateandtheinputvector[next_state,me
7、mory_contents]二nxt_stat(j,1,1,k);The%inputarrayvalueistheinputsignalvectorforrecordingthecurrentstatetothenextstateThedimensionofthe%inputarray:theone-dimensionalx二j+1isthecurrentstatevalueThe%2dcoordinatesy二nextstate+1isthevalueofthenextstateBecausetheindexofthea
8、rrayinMatlabstartsat1,thestatevalueItstartsat0,sotheabovevaluesare:statevalue+1Input(j+1,next_state+1)=1;%branchoutputisusedtorecordtheoutputwhenthe1ise