?? cnv_encd.m
字號:
function output=cnv_encd(g,k0,input)
%k0=2;
%g=[0 0 1 0 1 0 0 1;0 0 0 0 0 0 0 1;1 0 0 0 0 0 0 1];
%input=[1 0 0 1 1 1 0 0 1 1 0 0 0 0 1 1 1];
%check to see if extra zero padding is necessary
if rem(length(input),k0)>0
input=[input,zeros(size(1:k0-rem(length(input),k0)))];
end
%check the size of matrix g
n=length(input)/k0;
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))];
% gerenate 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));
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -