Next  |  Prev  |  Up  |  Top  |  Index  |  JOS Index  |  JOS Pubs  |  JOS Home  |  Search


Parallel SOS to Transfer Function: psos2tf

Figure J.7 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.7: 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,:));
end


Next  |  Prev  |  Up  |  Top  |  Index  |  JOS Index  |  JOS Pubs  |  JOS Home  |  Search

[How to cite this work]  [Order a printed hardcopy]  [Comment on this page via email]

``Introduction to Digital Filters with Audio Applications'', by Julius O. Smith III, (September 2007 Edition)
Copyright © 2024-04-18 by Julius O. Smith III
Center for Computer Research in Music and Acoustics (CCRMA),   Stanford University
CCRMA