next up previous
Next: Some numerical primitive 2 Up: Introduction to SCILAB Previous: Operations

Some numerical primitive 1

-->inv(A)                       //Inverse
 ans  =
!   0.5    0.           0.   !
!   0.     0.3333333    0.   !
!   0.     0.           0.25 !
-->inv(Mp)                      //Inverse
 ans  =
         column 1
!                  2      3           !
!            z + 3z + 4.5z            !
!   -------------------------------   !
!              2     3     4        5 !
! - 1 + 2z + 6z + 18z + 27z + 20.25z  !
!                                     !
!                - 1                  !
!   -------------------------------   !
!              2     3     4        5 !
! - 1 + 2z + 6z + 18z + 27z + 20.25z  !
         column 2
!              - 1 + z                !
!   -------------------------------   !
!              2     3     4        5 !
! - 1 + 2z + 6z + 18z + 27z + 20.25z  !
!                                     !
!                         2           !
!            1 + 3z + 4.5z            !
!   -------------------------------   !
!              2     3     4        5 !
! - 1 + 2z + 6z + 18z + 27z + 20.25z  !
-->inv(Sl*Sl')                  //Product of two linear systems and inverse
 ans  =
       ans(1)   (state-space system:)
!lss  A  B  C  D  X0  dt  !
       ans(2) = A matrix =
!   2.8641369  - 0.9304438    0.    0. !
!   0.4111970    2.1358631    0.    0. !
!   0.         - 9.339D-16    4.    0. !
!   0.           0.           0.    4. !
       ans(3) = B matrix =
!   0.7027925 !
!   0.3620534 !
!   1.665D-16 !
!   0.        !
       ans(4) = C matrix =
! - 0.3238304    0.6285968    1.890D-15    0. !
       ans(5) = D matrix =
                      2
    2.75 - 2.5s + 0.5s
       ans(6) = X0 (initial state) =
!   0. !
!   0. !
!   0. !
!   0. !
       ans(7) = Time domain =
 c
-->w=ss2tf(ans)                 //Transfer function representation
 w  =
                    2    3      4
    18 - 30s + 18.5s - 5s + 0.5s
    ----------------------------
                        2
            6.5 - 5s + s
-->w1=inv(ss2tf(Sl)*ss2tf(Sl'))    //Product of two transfer functions and inverse
 w1  =
                  2     3   4
    36 - 60s + 37s - 10s + s
    ------------------------
                      2
         13 - 10s + 2s
-->clean(w-w1)
 ans  =
    1.730D-09 - 6.605D-10s
    ----------------------
                     2
         6.5 - 5s + s
-->A=rand(3,3);;B=rand(3,1);n=contr(A,B)                 //Controllability
 n  =
    3.
-->K=ppol(A,B,[-1-%i -1+%i -1])        //Pole placement
 K  =
!   7.1638394    7.2295307    0.3176982 !
-->poly(A-B*K,'z')-poly([-1-%i -1+%i -1],'z')    //Check...
 ans  =
                                       2
  - 8.882D-16 + 1.776D-15z - 1.332D-15z


Scilab group