⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sdir2cas.m

📁 Digital Signal Processing Using MATLAB V.4随书代码
💻 M
字号:
function [C,B,A] = sdir2cas(b,a);% DIRECT-form to CASCADE-form conversion in s-plane% -------------------------------------------------% [C,B,A] = sdir2cas(b,a)%  C = gain coefficient%  B = K by 3 matrix of real coefficients containing bk's%  A = K by 3 matrix of real coefficients containing ak's%  b = numerator polynomial coefficients of DIRECT form%  a = denominator polynomial coefficients of DIRECT form%Na = length(a)-1; Nb = length(b)-1;% compute gain coefficient Cb0 = b(1); b = b/b0;a0 = a(1); a = a/a0; C = b0/a0;%% Denominator second-order sections:p= cplxpair(roots(a)); K = floor(Na/2);if K*2 == Na     % Computation when Na is even   A = zeros(K,3);   for n=1:2:Na       Arow = p(n:1:n+1,:);       Arow = poly(Arow);       A(fix((n+1)/2),:) = real(Arow);   endelseif Na == 1   % Computation when Na = 1       A = [0 real(poly(p))];else             % Computation when Na is odd and > 1   A = zeros(K+1,3);   for n=1:2:2*K       Arow = p(n:1:n+1,:);       Arow = poly(Arow);       A(fix((n+1)/2),:) = real(Arow);       end       A(K+1,:) = [0 real(poly(p(Na)))];end% Numerator second-order sections:z = cplxpair(roots(b)); K = floor(Nb/2);if Nb == 0           % Computation when Nb = 0   B = [0 0 poly(z)];elseif K*2 == Nb     % Computation when Nb is even   B = zeros(K,3);   for n=1:2:Nb       Brow = z(n:1:n+1,:);       Brow = poly(Brow);       B(fix((n+1)/2),:) = real(Brow);   endelseif Nb == 1       % Computation when Nb = 1       B = [0 real(poly(z))];else                 % Computation when Nb is odd and > 1   B = zeros(K+1,3);   for n=1:2:2*K       Brow = z(n:1:n+1,:);       Brow = poly(Brow);       B(fix((n+1)/2),:) = real(Brow);   end   B(K+1,:) = [0 real(poly(z(Nb)))];end

⌨️ 快捷键说明

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