a_output.m
来自「英文书《Digital Signal Processing with Examp」· M 代码 · 共 29 行
M
29 行
function [yout,N,M]=a_output(y,Nbits,bit,Nbtf,ipr);
% Function used by a_encode to stuff bits into y, 8 bits per word.
% [yout,N,M]=altered values of [y,Nbits,Nbtf].
% M=Nbtf ("# bits to follow") is always returned =0.
% N=next bit to be used. (Not used yet.) N begins at zero.
% ipr has the same effect here as in a_encode when =2.
yout=y;
iy=fix(Nbits/8)+1;
if iy>length(y),
error('Vector y has been exceeded.')
end
ibit=Nbits-8*(iy-1);
yout(iy)=yout(iy)+bit*2^(7-ibit);
N=Nbits+1;
if ipr==2,
fprintf([blanks(60),'Nbits, Bit out: %4.0f%3.0f\n'],N,bit);
end
M=Nbtf;
while M>0;
iy=fix(N/8)+1;
ibit=N-8*(iy-1);
yout(iy)=yout(iy)+(1-bit)*2^(7-ibit);
N=N+1;
if ipr==2,
fprintf([blanks(60),'Nbits, Bit adj: %4.0f%3.0f\n'],N,1-bit);
end
M=M-1;
end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?