MATLAB PCMUQC 解码函数:将 8 位 PCM 码转换为十进制数值
function [outData] = PCMUQC_Decode( inputData)
n=length(inputData); outData=zeros(1,n/8); MM=zeros(1,8); for kk=1:n/8 MM(1:8)=inputData(1,(kk-1)8+1:kk8); %取得8位PCM码
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% stuednt code %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%task:理解PCM编码原理,将8位PCM码MM中的二进制段落码转化为十进制数,将其值赋给temp。
temp=0;
for ii=1:8
temp=temp+MM(ii)*2^(8-ii);
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
outData(1,kk)=temp; %将temp值存入outData数组
end end
原文地址: https://www.cveoy.top/t/topic/or6Q 著作权归作者所有。请勿转载和采集!