7 Example 2.17 OGATA 4ed (Laplace transformed, differential equations)

Let's solve the following differential equation by scilab:

\begin{displaymath}\ddot{x}+2\dot{x}+10\cdot x=t^{2}\end{displaymath}



\begin{displaymath}x(0)=0\end{displaymath}



\begin{displaymath}dot{x}(0)=0 \end{displaymath}


The Laplace transformed is:

\begin{displaymath}s^{2}\cdot X(s)+2\cdot X(s)\cdot s+10\cdot X(s)=\frac{2}{s^{3}}\end{displaymath}


What we would:

\begin{displaymath}X(s)=\frac{2}{s^{3}\cdot (s^{2}+2\cdot s+10)}\end{displaymath}


Let's get the Partial-fraction expansion using Scilab:
s=%s
num=2;
den=s^3*(s^2+2*s+10);
g=syslin('c',num/den);
gf=tf2ss(g);
se=pfss(gf);
Scilab Result:
se  =
 
 
       se(1)
 
                        2  
    0.2 - 0.04s - 0.012s   
    --------------------   
              3            
             s             
 
       se(2)
 
    0.064 + 0.012s   
    --------------   
                2    
     10 + 2s + s

With us what the system is:

\begin{displaymath}X(s)=\frac{-0.012\cdot s^{2}-0.04\cdot s+0.2}{s^{3}}+\frac{0.012\cdot s+0.064}{s^{2}+2\cdot s+10}\end{displaymath}


Let's break down first se(1) by scilab add more lines of code:

 

Lines to add in Scilab
r=roots(denom(se(1)));
a(3)=horner(s^3*se(1),r(1));
a(2)=horner(derivat(s^3*se(1)),r(1));
a(1)=horner(derivat(derivat(s^3*se(1))),r(1))/2;
for k=1:3,
ds1(k)=a(k)/s^k,
end;

Result in the development of se(1) by Scilab are:
 ds1  =
 
 
       ds1(1)
 
            
   -0.012   
   -------  
            
     s      
 
       ds1(2)
 
           
   -0.04   
   ------  
      2    
     s     
 

       ds1(3)
 
         
   0.2   
   ----  
     3   
    s

Thereby partial-fraction expansion of se(1) remains:

\begin{displaymath}\frac{-0.012\cdot s^{2}-0.04\cdot s+0.2}{s^{3}}=\frac{-0.012}{s}-\frac{0.04}{s^{2}}+\frac{0.2}{s^{3}}\end{displaymath}


The partial-fraction expansion of se2 get:

\begin{displaymath}\frac{0.012\cdot s+0.064}{s^{2}+2\cdot s+10}=\frac{0.012\cdot...
...+3^{2}}=\frac{12\cdot s+12-12+64}{1000\cdot ((s+1)^{2}+3^{2})}=\end{displaymath}



\begin{displaymath}=\frac{12\cdot (s+1)-12+64}{1000\cdot ((s+1)^{2}+3^{2})}=\fra...
...cdot ((s+1)^{2}+3^{2})}+\frac{52}{1000\cdot ((s+1)^{2}+3^{2})}=\end{displaymath}



\begin{displaymath}=0.012\cdot e^{-t}\cdot cos(3t)+\frac{0.052}{3}\cdot e^{-t}\cdot sen(3t) \end{displaymath}


So the Laplace transformed, we would:

\begin{displaymath}X(s)=\frac{-0.012}{s}-\frac{0.04}{s^{2}}+\frac{0.2}{s^{3}}+0....
...ot e^{-t}\cdot cos(3t)+\frac{0.052}{3}\cdot e^{-t}\cdot sen(3t)\end{displaymath}