将分子和分母多项式分解为偶数和奇数部分

Decomposing the numerator and the denominator polynomials into their even and odd parts

这里有一个连续时间传递函数(G(s)),形式为:

G(s) = N(s)/D(s);
G(s) = (s^3+4s^2-s+1)/(s^5+2s^4+32s^3+14s^2-4s+50)     (1)

(s = j*w) 其中 w = frequency symbol.

现在分子和分母怎么分解 方程式的多项式。 (1) 进入偶数和奇数部分并得到 G(jw) 作为(使用 Matlab):

s=j*w 替换后,您可能可以取实部和虚部。但是,您实际上可以 select 多项式的偶数部分和奇数部分:

% G(s) = N(s)/D(s);

syms s;
N = s^3+4*s^2-s+1;

p = sym2poly(N);

%// do this in fewer lines:
%{
/*
if mod(length(p),2)==0  %// then first index is odd
    imin_o = 1;  %// for odd part
    imin_e = 2;  %// for even part
else
    imin_o = 2;  %// for odd part
    imin_e = 1;  %// for even part
end
*/
%} 
imin_o = mod(length(p),2) + 1;
imin_e = 2 - mod(length(p),2);

% odd part of numerator
p_o = zeros(size(p));
p_o(imin_o:2:end) = p(imin_o:2:end);
% even part of numerator
p_e = zeros(size(p));
p_e(imin_e:2:end) = p(imin_e:2:end);

% restore
N_o = poly2sym(p_o,s);
N_e = poly2sym(p_e,s);

分母也一样