dm_encoder.m

来自「By using a MATLAB program, design a Delt」· M 代码 · 共 26 行

M
26
字号
function cn=dm_encoder(x, StepSize)
%DM_encoder constant step size Delta Modulator.
%function cn=DeltaModulation(x, StepSize)
%StepSize: Step size for the delta modulator.
%x: sampled input signal, where fs>=5*Nyquist rate.
%cn:encoded binary data.


%staircase generator and comparator (quantizer)
xlen = length(x);
accum(1) = 0;
for i=1:xlen
   if(x(i)>=accum(i))
      e_tilda_n(i)=1;
      accum(i+1) = accum(i) + e_tilda_n(i) * StepSize;
   else
      e_tilda_n(i)=-1;
      accum(i+1) = accum(i) + e_tilda_n(i) * StepSize;
      tx(i)=0;
   end
end

%encoder
cn = e_tilda_n < 0; % stair approximation狼 阿 基敲阑 搬沥窍绰 e(nTs)蔼俊 蝶扼辑 0,1肺 捞风绢柳 binary code 累己

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?