📄 poly2matrix.m
字号:
function [d, h_coeff] = poly2matrix(h)
% [d, h_coeff] = poly2matrix(h)
% convert the filter coefficients into matrix form
% input: h -- analysis filters in the form of multivariate polynamial
% output: d -- lowest degrees of z0 and z1 in h0 and h1 (if d(1) or d(2) > 0, then set to 0)
% h_coeff -- analysis filters in matrix form
% Copyright (c) 2006 Yi Chen
syms z0 z1
% lowest degree of h0 and h1 in terms of z0 and z1
d(1) = double(maple('ldegree',h,z0));
d(2) = double(maple('ldegree',h,z1));
% shift the polynomial to remove negative degree
if d(1) < 0
h_t = expand(h*z0^(-d(1)));
else
h_t = h;
end
if d(2) < 0
h_t = expand(h_t*z1^(-d(2)));
else
h_t = h_t;
end
% length of the filter in both directions
lz0 = double(maple('degree',h_t,z0));
lz1 = double(maple('degree',h_t,z1));
% h0_coeff and h1_coeff are the matrix form coefficients
h_coeff = zeros(lz1+1,lz0+1);
coeff_t = sym2poly(maple('coeff',h_t,z1,0));
h_coeff(1,1:length(coeff_t)) = fliplr(coeff_t);
for i = 2:lz1+1
coeff_t = sym2poly(maple('coeff',h_t,z1^(i-1)));
h_coeff(i,1:length(coeff_t)) = fliplr(coeff_t);
end
h_coeff = h_coeff';
if d(1) > 0
d(1) = 0;
end
if d(2) > 0
d(2) = 0;
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -