channel_coding.m
资源名称:MIMO-OFDM.rar [点击查看]
上传用户:look542
上传日期:2009-06-04
资源大小:784k
文件大小:2k
源码类别:
传真(Fax)编程
开发平台:
Matlab
- function coded_user_bit = channel_coding( user_bit,ChCodingMethod,Dec_alg,L_total,Generator,Puncture,...
- N_iter,RateChCoding,Alpha,Turbo_frame,N_Turbo_frame,UserRS_Coding ,UserTrellis,...
- TraceBackLen,turn_on )
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % 根据不同用户的信道编码参数,进行信道编码
- % 输入: user_bit, 用户比特
- % UserRS_Coding, 每个用户的RS码参数
- % UserTrellis,每个用户的卷积码trellis 结构体
- % TraceBackLen, 卷积码译码深度
- % turn_on, 是否打开此功能
- % 输出: coded_user_bit, 已编码的用户比特
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- if turn_on
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % 使用Turbo码 + 交织
- if ChCodingMethod == 1
- % 先假设单用户情况
- bits = user_bit{1}';
- turbo_coded = zeros( 1,L_total/RateChCoding * N_Turbo_frame);
- for n = 1:N_Turbo_frame
- bit_frame = bits( (n-1)*Turbo_frame + 1:n*Turbo_frame );
- en_output = encoderm( bit_frame, Generator, Alpha, Puncture );
- turbo_coded(1, (n-1)*L_total/RateChCoding + 1:n*L_total/RateChCoding ) = en_output ;
- end
- coded_user_bit{1} = turbo_coded' ;
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % 使用卷积 + RS + 交织
- elseif ChCodingMethod == 2
- N_user = size( UserRS_Coding ,2);
- for u = 1:N_user
- user_rscode{u} = rsenco(user_bit{u} ,UserRS_Coding(1,u),UserRS_Coding(2,u));
- user_rscode2{u} = [ user_rscode{u} ; zeros( TraceBackLen , 1)];
- user_convcode{u} = convenc(user_rscode2{u},UserTrellis(u));
- end
- coded_user_bit = user_convcode;
- end
- else
- coded_user_bit = user_bit;
- end