summaryrefslogtreecommitdiff
path: root/modules/polynomials/macros/pol2des.sci
blob: 699f1af1e1e8bcb26aa368709bd7811c326bcac6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) ????-2008 - INRIA
//
// This file must be used under the terms of the CeCILL.
// This source file is licensed as described in the file COPYING, which
// you should have received as part of this distribution.  The terms
// are also available at
// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt


function [N,B,C]=pol2des(Ds)
    // Given the polynomial matrix Ds= D_0 +D_1 s +D_2 s^2 + ... +D_k s^k,
    // pol2des returns three  matrices N,B,C  (with N nilpotent) such that
    // Ds = C (sN-Eye)^-1 B
    //!
    if type(Ds)==1 then Ds=Ds+0*poly(0,"s")*Ds;end
    dg=max(degree(Ds))+1;
    [nout,nin]=size(Ds);
    [Sl]=markp2ss(coeff(Ds),dg,nout,nin);
    N=Sl(2);B=-Sl(3);C=Sl(4)
endfunction