1

In this Scilab code, I am converting a state space system to a transfer function and the output should be G(s)= (s+3)/(s^3+6s^2+11s+6) but I got this output G(s)=(1 +8.882D-16s)/(2 +3s +s² ) . I know there is a common factor (s+3) between a numerator and a denominator that had been cancelled but if I converted the same transfer function to a state space system again, I will get a different system with different matrices dimensions and values than the original system which does not happen in Matlab. Is there any way to avoid this problem and remove this term (8.882D-16s) from the transfer function?

clear
A=[-1 0 1; 1 -2 0;0 0 -3];
B=[0;0;1];
C=[1 1 0];
D=[0];
sys=syslin('c', A, B, C, D); // c....continuous time domain system
//linear system
G=ss2tf(sys)
disp(G)
ss=tf2ss(G)
[A,B,C,D]=abcd(ss) ```
       
Dr.mark
  • 49
  • 4

1 Answers1

0

Matlab does some implicit cleaning. You can do this explicitely in Scilab:

--> G=clean(ss2tf(sys))
 G  = 

       1      
   ---------  
   2 +3s +s²  
Stéphane Mottelet
  • 2,853
  • 1
  • 9
  • 26
  • Thanks @Stéphane Mottelet. It works, is there any way to avoid the common factor cancellation in G(s) and can I find a command in Scilab which is equivalent to rlocfind in Matlab? – Dr.mark Aug 19 '22 at 01:17
  • To prevent common factor cancellation use `simp_mode(%f)`. There is no `rlocfind` in Scilab but you can use `evans` and activate datatips then click the desired point on the root locus. – Stéphane Mottelet Aug 19 '22 at 06:42