1 内容介绍
运用MATLAB仿真抽样信号的频谱,分析满足不同条件下的抽样情况,验证奈奎斯特抽样定理;不同量化电平情况下的信噪比的计算,对PCM调制系统中的非均匀量化的压扩技术和编码进行仿真与计算.
2 部分代码
%PCM解码
function [out]= pcm_decode(in,v)
%in :input the pcm code 8bits sample
%v; quantized level
n = length(in);
in=reshape(in',8,n/8)'; %书上有引号我没加
slot(1) = 0;
slot(2) = 32;
slot(3) = 64;
slot(4) = 128;
slot(5) = 256;
slot(6) = 512;
slot(7) = 1024;
slot(8) = 2048;
step(1) = 2;
step(2) = 2;
step(3) = 4;
step(4) = 8;
step(5) = 16;
step(6) = 32;
step(7) = 64;
step(8) = 128;
for i=1:n/8
ss = 2 * in(i,1) - 1;
tmp = in(i,2)*4 + in(i,3)*2 + in(i,4) + 1;
st = slot(tmp);
dt = (in(i,5)*8 + in(i,6)*4 + in(i,7) * 2 + in(i,8))*step(tmp) + 0.5*step(tmp);
out(i) = ss*(st + dt)/4096*v;
end
3 运行结果
4 参考文献
[1]程菊花, 姜武. 基于MATLAB的PCM调制系统的仿真与分析[J]. 浙江传媒学院学报, 2005(3):3.