1
function [h,num,den]=ss2tf(sl,rmax)
2
// State-space to transfer function.
8
// sl : linear system (syslin list)
10
// rmax : optional parameter controlling the conditioning in
11
// block diagonalization method is used (If 'b' is entered
12
// a default value is used)
13
// Method: By default, one uses characteristic polynomial and
14
// det(A+Eij)=det(A)+C(i,j) where C is the adjugate matrix of A
15
// Other method used : block-diagonalization (generally
16
// this gives a less accurate result).
20
if type(sl)==1|type(sl)==2 then
25
if (type(sl)<>16)|flag(1)<>'lss' then
26
error('First argument must be in state-space form')
28
if sl(3)==[] then h=sl(5);num=sl(5);den=eye(sl(5));return;end
29
if sl(4)==[] then h=sl(5);num=sl(5);den=eye(sl(5));return;end
30
if size(sl(2),'*')==0 then
36
if type(domaine)==1 then var='z';end
37
if domaine=='c' then var='s';end;
38
if domaine=='d' then var='z';end;
41
if type(sl(5))==2 then var=varn(sl(5));end
47
if type(rmax)==10 then
62
[a,x,bs]=bdiag(a,rmax)
64
k=1;m=[];v=ones(1,n1);den=1;
78
if l<>[] then v(l)=v(l)*d,end
82
if lhs==3 then h=sl(5),num=sl(4)*m*diag(v)*(x\sl(3));return;end
83
m=sl(4)*m*diag(v)*(x \ sl(3))+sl(5)*den;
84
[m1,n1]=size(m);[m,den]=simp(m,den*ones(m1,n1))
85
h=syslin(domaine,m,den)
87
Den=real(poly(sl(2),var))
88
na=degree(Den);den=[];
92
[m,i]=maxi(abs(c(l,:)));
95
t=eye(na,na)*ci;t(i,:)=[-c(l,1:i-1), 1, -c(l,i+1:na)]
97
t=eye(na,na)/ci;t(i,:)=[c(l,1:i-1)/ci, 1, c(l,i+1:na)/ci]
102
[nlk,dlk]=simp(real(poly(al,var)),Den)
104
num(l,k)=-(nlk-dlk)*ci
107
num(l,1:n)=0*ones(1,n);
108
den(l,1:n)=ones(1,n);
111
if lhs==3 then h=sl(5);return;end
113
if type(w)==1 then h=w;return;end //degenerate case