相关代码 |
|
function example01; % out=randint(3,5,[-4,7]) % out=randsrc(3,5,[-3 -1 1 3;0.25 0.25 0.25 0.25]) % [index,quants,distor]=quantiz([3 34 84 40 23],10:10:90,10:10:100) t=[0:0.1:2*pi]; s=sin(t); partition=[-1:0.2:1]; codebook=[-1.2:0.2:1]; [index,quants,distor]=quantiz(s,partition,codebook); [partition2,codebook2]=lloyds(s,codebook); [index2,quants2,distor2]=quantiz(s,partition2,codebook2); plot(t,s,t,quants,'.',t,quants2,'*'); [distor,distor2]