function [a,b,c,d] = ss(h)
%SS  Parallel object to state-space conversion.

%   Author(s): R. Losada
%   Copyright 1988-2000 The MathWorks, Inc.
%   $Revision: 1.2 $  $Date: 2000/06/13 21:22:34 $ 

% Initialize state-space model
a=[]; b=[]; c=[]; d=0;

% Form the state-space model of the parallel filter recursively
for n = 1:nsections(h),
    
    % Generate a temporary state-space model per section
    [at,bt,ct,dt] = ss(section(h,n));
    
    % Combine section with overall state-space model
    [a,b,c,d] = parallel_ss(a,b,c,d,at,bt,ct,dt);
end

%-----------------------------------------------------------------------------------
function [a,b,c,d] = parallel_ss(a1,b1,c1,d1,a2,b2,c2,d2)
%PARALLEL_SS  Form a state-space representation of two state-space systems in parallel.

a = [a1, zeros(size(a1,1),size(a2,2));zeros(size(a2,1),size(a1,2)), a2];

b = [b1;b2];

c = [c1, c2];

d = d2+d1;

% [EOF] - SS

