📄 poly2matrix_sym.m
字号:
function [d, h_coeff] = poly2matrix_sym(h)
% [d, h_coeff] = poly2matrix_sym(h)
% convert the symbolic coefficients into matrix form
% input: h -- analysis filters in the form of multivariate polynamial
% output: d -- lowest degrees of z0 and z1 in h
% 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));
% h_coeff is the matrix form coefficients
h_coeff = sym(zeros(lz1+1,lz0+1));
coeff_t = maple('coeff',h_t,z1,0);
h_coeff(1,1) = maple('coeff',coeff_t,z0,0);
for j = 2:lz0+1
h_coeff(1,j) = maple('coeff',coeff_t,z0^(j-1));
end
for i = 2:lz1+1
coeff_t = maple('coeff',h_t,z1^(i-1));
h_coeff(i,1) = maple('coeff',coeff_t,z0,0);
for j = 2:lz0+1
h_coeff(i,j) = maple('coeff',coeff_t,z0^(j-1));
end
end
h_coeff = transpose(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 + -