matlab卷积码函数,谁有卷积码的MATLAB程序···?

function output=cnv_encd(g,k0,input)

%                  cnv_encd(g,k0,input)

%                  determines the output sequence of a binary convolutional encoder

%                  g is the generator matrix of the convolutional code

%                with n0 rows and l*k0 columns. Its rows are g1,g2,...,gn.

%                  k0 is the number of bits entering the encoder at each clock cycle.

%                  input The binary input seq.

%  check to see if extra zero padding is necessary

%  output的前2*length(input)位为有效输出位

if rem(length(input),k0) > 0

input=[input,zeros(size(1:k0-rem(length(input),k0)))];

end

n=length(input)/k0;

%  check the size of matrix g

if rem(size(g,2),k0) > 0

error('Error, g is not of the right size.')

end

%  determine l and n0

l=size(g,2)/k0;

n0=size(g,1);

%  add extra zeros

u=[zeros(size(1:(l-1)*k0)),input,zeros(size(1:(l-1)*k0))];

%  generate uu, a matrix whose columns are the contents of

%  conv. encoder at various clock cycles.

u1=u(l*k0:-1:1);

for i=1:n+l-2

u1=[u1,u((i+l)*k0:-1:i*k0+1)];

end

uu=reshape(u1,l*k0,n+l-1);

%  determine the output

output=reshape(rem(g*uu,2),1,n0*(l+n-1));

[本帖最后由 xiachaoabc 于 2009-11-5 21:41 编辑]

f5c3d56501a3d0261ce0cb81cbf824a7.gif

2009-11-5 21:40 上传

点击文件名下载附件

1.07 KB, 下载次数: 31889

f5c3d56501a3d0261ce0cb81cbf824a7.gif

2009-11-5 21:41 上传

点击文件名下载附件

1.07 KB, 下载次数: 13046

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值