dead_zone_q.m

来自「zerotree的寫法,給大家參考」· M 代码 · 共 27 行

M
27
字号
function Y=dead_zone_q(X,qstep)
%x = dead_zone_q(x,qstep)
%Version: 1.00, Date: 2004/12/01, author: Nikola Sprljan
%Quantisation with a dead-zone around zero 
%
%Input: 
% X - original matrix
% qstep - quantisation step (threshold)
%
%Output:
% Y - quantised matrix
%
%Note:
% Dead zone is equal to the quantisation step, i.e. all coefficients whose
% absolute value is <qstep get quantised to 0.
%
%Example:
% Y=dead_zone_q(X,0.5);

if (~isfloat(X)) X = double(X);end;  
Xs = sign(X);
Y = abs(X);
Y(Y<qstep) = 0;
Y = floor(Y/qstep);
Y(Y~=0) = Y(Y~=0)+0.5;
Y = Xs.*Y*qstep;

⌨️ 快捷键说明

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