Parallel SOS to Transfer Function: psos2tf.m

Figure J.10 lists a matlab function for computing the direct-form transfer-function polynomials $ B(z)/A(z)$ from parallel second-order section coefficients. This is in contrast to the existing function sos2tf which converts series second-order sections to transfer-function form.

Figure J.10: Matlab/Octave function for computing direct-form transfer-function coefficients B and A from a matrix of second-order section coefficients sos and overall gain factor g.

function [B,A] = psos2tf(sos,g)

if nargin<2, g=1; end

[nsecs,tmp] = size(sos);
if nsecs<1, B=[]; A=[]; return; end
Bs = sos(:,1:3);
As = sos(:,4:6);
B = Bs(1,:);
A = As(1,:);
for i=2:nsecs
  B = conv(B,As(i,:)) + conv(A,Bs(i,:));
  A = conv(A,As(i,:));

Next Section:
Group Delay Computation: grpdelay.m
Previous Section:
Partial Fraction Expansion: residued.m