vanishing_num.m

来自「MATLAB Code for Optimal Quincunx Filter 」· M 代码 · 共 31 行

M
31
字号
function N = Vanishing_num(h)
% compute the number of vanishing moments by the nubmer of zeros at the
% origin of the highpass frequency response
% input:  h -- highpass filter coefficients
% output: N -- order of at the origin
% Copyright (c) 2006 Yi Chen

% check the vanishing moments
N = 1;
hx(1) = 0;

sizeh = size(h);
n0 = -(sizeh(1)-1)/2:(sizeh(1)-1)/2;
n1 = -(sizeh(2)-1)/2:(sizeh(2)-1)/2;
[n1,n0] = meshgrid(n1,n0);
ind = 1;

while max(abs(hx)) < 1e-3    
    for j = 0:N-1
        for k = 0:j;
            matrix_h = (n0.^k).*(n1.^(j-k));
            hx(ind) = sum(sum(matrix_h.*h));
            ind = ind + 1;
        end
    end
    ind = 1;
    N = N + 1;
end

N = N - 2;
hx = hx(:)';

⌨️ 快捷键说明

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