Code covered by the BSD License

# Rsyso

### Franklin Pineda (view profile)

Finds realizations of SISO linear systems. Autonoma of Colombia University.

[G Ginf]=paralleldtf(Gt)
```function [G Ginf]=paralleldtf(Gt)
% PARALLELDTF Parallel Descomposition of the Transfer Function
%
% Syntax:  [G Ginf] = parallleldtf(Gt)
%
% Inputs:
%    SYS - LTI SISO system, in Transfer Function -TF
%    representation.
%
% Outputs:
%    G     - Matrix with the simple transfer functions
%    Ginf  - Scalar when the transfer function is biproper Gt= G + Ginf
%
% Example:
%   G1=tf([1 0],conv(conv([1 1],[1 1]),conv([1 2],[1 2])));
%
%   [G]=paralleldtf(Gt)
%
% Other m-files required:
% Subfunctions:          mtfsp
%                        cellround
%
%
% Author: Franklin Pineda
% email: franklin.pineda@fuac.edu.co
% Created: March 2011;
% Last revision: 11-March-2011;

% May be distributed freely for non-commercial use,
% but please leave the above info unchanged, for
% credit and feedback purposes

%------------- BEGIN CODE --------------
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
[num den]=tfdata(Gt);
num=cell2mat(num);
den=cell2mat(den);
[r p Ginf]=residue(num,den);
m=multiplicity(p);
warning off all
for i=1:length(r)
for j=1:m(i)
poles(j)=p(i);
end
G(i)=zpk([],poles,r(i));
end
i=1;
while i<=length(G)
if ~isreal(G(i))
G(i)=G(i)+G(i+1);
G(i+1)=[];
end
i=i+1;
end
if isempty(Ginf)
Ginf=0;
end

function m=multiplicity(p)
up=unique(p);
for i=1:length(up)
n=find(p==up(i));
if length(n)==1
m(n)=1;
else
for j=1:length(n)
m(n(j))=j;
end
end
end
```