viterbi.rar

  • YANG-TAO
    了解作者
  • matlab
    开发工具
  • 1KB
    文件大小
  • rar
    文件格式
  • 0
    收藏次数
  • 10 积分
    下载积分
  • 3
    下载次数
  • 2018-03-08 20:44
    上传日期
正交相移键控(Quadrature Phase Shift Keyin,QPSK)是一种数字调制方式。它分为绝对相移和相对相移两种。由于绝对相移方式存在相位模糊问题,所以在实际中主要采用相对移相方式DQPSK
viterbi.rar
  • metric.m
    79B
  • viterbi.m
    3.7KB
  • bin2deci.m
    69B
  • deci2bin.m
    130B
内容介绍
function [decoder_output,survivor_state,cumulated_metric]=viterbi(G,k,channel_output) %VITERBI The Viterbi decoder for convolutional codes % [decoder_output,survivor_state,cumulated_metric]=viterbi(G,k,channel_output) % G is a n x Lk matrix each row of which % determines the connections from the shift register to the % n-th output of the code, k/n is the rate of the code. % survivor_state is a matrix showing the optimal path through % the trellis. The metric is given in a separate function metric(x,y) % and can be specified to accommodate hard and soft decision. % This algorithm minimizes the metric rather than maximizing % the likelihood. n=size(G,1); % check the sizes if rem(size(G,2),k) ~=0 error('Size of G and k do not agree') end if rem(size(channel_output,2),n) ~=0 error('channel output not of the right size') end L=size(G,2)/k; number_of_states=2^((L-1)*k); % Generate state transition matrix, output matrix, and input matrix. for j=0:number_of_states-1 for l=0:2^k-1 [next_state,memory_contents]=nxt_stat(j,l,L,k); input(j+1,next_state+1)=l; branch_output=rem(memory_contents*G',2); nextstate(j+1,l+1)=next_state; output(j+1,l+1)=bin2deci(branch_output); end end state_metric=zeros(number_of_states,2); depth_of_trellis=length(channel_output)/n; channel_output_matrix=reshape(channel_output,n,depth_of_trellis); survivor_state=zeros(number_of_states,depth_of_trellis+1); % Start decoding of non-tail channel outputs. for i=1:depth_of_trellis-L+1 flag=zeros(1,number_of_states); if i <= L step=2^((L-i)*k); else step=1; end for j=0:step:number_of_states-1 for l=0:2^k-1 branch_metric=0; binary_output=deci2bin(output(j+1,l+1),n); for ll=1:n branch_metric=branch_metric+metric(channel_output_matrix(ll,i),binary_output(ll)); end if((state_metric(nextstate(j+1,l+1)+1,2) > state_metric(j+1,1)... +branch_metric) || flag(nextstate(j+1,l+1)+1)==0) state_metric(nextstate(j+1,l+1)+1,2) = state_metric(j+1,1)+branch_metric; survivor_state(nextstate(j+1,l+1)+1,i+1)=j; flag(nextstate(j+1,l+1)+1)=1; end end end state_metric=state_metric(:,2:-1:1); end % Start decoding of the tail channel-outputs. for i=depth_of_trellis-L+2:depth_of_trellis flag=zeros(1,number_of_states); last_stop=number_of_states/(2^((i-depth_of_trellis+L-2)*k)); for j=0:last_stop-1 branch_metric=0; binary_output=deci2bin(output(j+1,1),n); for ll=1:n branch_metric=branch_metric+metric(channel_output_matrix(ll,i),binary_output(ll)); end if((state_metric(nextstate(j+1,1)+1,2) > state_metric(j+1,1)... +branch_metric) | flag(nextstate(j+1,1)+1)==0) state_metric(nextstate(j+1,1)+1,2) = state_metric(j+1,1)+branch_metric; survivor_state(nextstate(j+1,1)+1,i+1)=j; flag(nextstate(j+1,1)+1)=1; end end state_metric=state_metric(:,2:-1:1); end % Generate the decoder output from the optimal path. state_sequence=zeros(1,depth_of_trellis+1); state_sequence(1,depth_of_trellis)=survivor_state(1,depth_of_trellis+1); for i=1:depth_of_trellis state_sequence(1,depth_of_trellis-i+1)=survivor_state((state_sequence(1,depth_of_trellis+2-i)... +1),depth_of_trellis-i+2); end decodeder_output_matrix=zeros(k,depth_of_trellis-L+1); for i=1:depth_of_trellis-L+1 dec_output_deci=input(state_sequence(1,i)+1,state_sequence(1,i+1)+1); dec_output_bin=deci2bin(dec_output_deci,k); decoder_output_matrix(:,i)=dec_output_bin(k:-1:1)'; end decoder_output=reshape(decoder_output_matrix,1,k*(depth_of_trellis-L+1)); cumulated_metric=state_metric(1,1);
评论
    相关推荐
    • viterbi.rar
      卷积编码,编码速率1/2 QPSK调制 维特比译码
    • viterbi_qpsk.rar
      viterbi simulation K = 7 in qpsk modulation
    • QPSK.rar
      1在数字信号的调制方式中QPSK是最常用的一种卫星数字信号调制方式,它具有较高的频谱利用率、较强的抗干扰性、在电路上实现也较为简单。 2主要包括QPSK的调制解调
    • QPSK.rar
      用matlab软件仿真了从卷积码编码,QPSK调制,AWGN信道,QPSK解调,以及Viterbi译码
    • 卷积编码和viterbi译码,调制方式为qpsk的matlab程序
      卷积编码和viterbi译码,调制方式为qpsk的matlab程序
    • qpsk.zip
      understanding lte bpsk file
    • qpsk_viterbi_soft.rar
      modulation with vibertisoft in qpsk with bertool
    • qpsk_viterbi.rar
      modulation with viberti in qpsk with bertool
    • viterbi.zip
      基于MATLAB实现viterbi编译码过程
    • SIM800C_MQTT.rar
      使用SIM800C模块,使用MQTT协议,连接中国移动onenet平台,能实现数据的订阅、发布、存储等