📄 ds_quantize.m
字号:
function v = ds_quantize(y,n)%v = ds_quantize(y,n=2)%Quantize y to % an odd integer in [-n+1, n-1], if n is even, or% an even integer in [-n+1, n-1], if n is odd.%This definition gives the same step height for both mid-rise%and mid-tread quantizers.%n can be a column vector which specifies how to quantize the rows of yif nargin<2 n=2;endif length(n)==1 n = n*ones(size(y));elseif size(n,1)==size(y,1) n = n*ones(1,size(y,2));endi = rem(n,2)==0; v = zeros(size(y));v(i) = 2*floor(0.5*y(i))+1; % mid-rise quantizerv(~i) = 2*floor(0.5*(y(~i)+1)); % mid-tread quantizer% Limit the outputL = n-1;for m=[-1 1] i = m*v>L; if any(i(:)) v(i) = m*L(i); endend
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -