1.1 Creating tf and state space and different Conversion of forms

  1.1.1 Create continuous time transfer function given the poles, zeros and gain
  1.1.2 Convert transfer function to state space representation
  1.1.3 Create a state space representation from A,B,C,D and find the step response
  1.1.4 Convert continuous time to discrete time transfer function, gain and phase margins
  1.1.5 Convert differential equation to transfer functions and to state space
  1.1.6 Convert from continuous transfer function to discrete time transfer function
  1.1.7 Convert a Laplace transfer function to an ordinary differential equation

1.1.1 Create continuous time transfer function given the poles, zeros and gain

   1.1.1.1 Mathematica
   1.1.1.2 Matlab
   1.1.1.3 Maple

Problem: Find the transfer function \(H(s)\) given zeros \(s=-1,s=-2\), poles \(s=0,s=-4,s=-6\) and gain 5.

1.1.1.1 Mathematica



Out[30]= TransferFunctionModel[{ 
     {{5*(1 + s)*(2 + s)}}, 
     s*(4 + s)*(6 + s)}, s]



 

1.1.1.2 Matlab



num/den = 
    5 s^2 + 15 s + 10 
   ------------------- 
   s^3 + 10 s^2 + 24 s



 

1.1.1.3 Maple



\[ \text {tf} = \left [ {\begin {array}{c} {\frac {5\,{s}^{2}+15\,s+10}{{s}^{3}+10\,{s}^{2}+24\,s}}\end {array}} \right ] \]




\[ 5*s^2+15*s+10 \]




\[ s*(s^2+10*s+24) \]



 

1.1.2 Convert transfer function to state space representation

   1.1.2.1 problem 1
   1.1.2.2 Mathematica
   1.1.2.3 Matlab
   1.1.2.4 Maple
   1.1.2.5 problem 2

1.1.2.1 problem 1

Problem: Find the state space representation for the continuous time system defined by the transfer function \[ H(s)=\frac {5s}{s^{2}+4s+25}\]

1.1.2.2 Mathematica



pict




pict



 

1.1.2.3 Matlab



A = 
    -4   -25 
     1     0 
B = 
     1 
     0 
C = 
     5     0 
D = 
     0



 

1.1.2.4 Maple



\[ \left [{\begin {array}{cc} 0 & 1 \\ -25 & -4 \end {array}} \right ] \]




\[ \left [ {\begin {array}{c} 0\\ 1\end {array}} \right ] \]




\[ \left [ {\begin {array}{cc} 0&5\end {array}} \right ] \]




\[ \left [ {\begin {array}{c} 0\end {array}} \right ] \]



 

1.1.2.5 problem 2

Problem: Given the continuous time S transfer function defined by \[ H(s)=\frac {1+s}{s^{2}+s+1}\] convert to state space and back to transfer function.



Mathematica


\[ \left ( {\begin {array}{cc|c|c} 0 & 1 & 0 \\ -1 & -1 & 1 \\ \hline 1 & 1 & 0 \\ \end {array}} \right )_{} \]


\[ \frac {s+1}{s^2+s+1} \]



 


Matlab









 

1.1.3 Create a state space representation from A,B,C,D and find the step response

Problem: Find the state space representation and the step response of the continuous time system defined by the Matrices A,B,C,D as shown




Mathematica


pict



 


Matlab


pict



 


Maple


pict



 

1.1.4 Convert continuous time to discrete time transfer function, gain and phase margins

Problem: Compute the gain and phase margins of the open-loop discrete linear time system sampled from the continuous time S transfer function defined by \[ H(s)=\frac {1+s}{s^{2}+s+1}\] Use sampling period of 0.1 seconds.



Mathematica


pict




pict








pict



 


Matlab






pict



 

1.1.5 Convert differential equation to transfer functions and to state space

Problem: Obtain the transfer and state space representation for the differential equation \[ 3\frac {d^{2}y}{dt^{2}}+2\frac {dy}{dt}+y\relax (t) = u(t) \]



Mathematica


pict




pict



 


Matlab









 


Maple


\[ \frac {1}{3{s}^{2}+2\,s+1} \]




\[ \left \{ \left [ {\begin {array}{cc} 0&1\\ \noalign {\medskip }-1/3&-2/3 \end {array}} \right ] , \left [ {\begin {array}{c} 0\\ \noalign {\medskip } 1\end {array}} \right ] , \left [ {\begin {array}{cc} 1/3&0\end {array}} \right ] , \left [ {\begin {array}{c} 0\end {array}} \right ] \right \} \]



 

1.1.6 Convert from continuous transfer function to discrete time transfer function

Problem: Convert \[ H\relax (s) = \frac {1}{s^2+10 s+10} \]

To \(Z\) domain transfer function using sampling period of \(0.01\) seconds and using the zero order hold method.



Mathematica


pict



 


Matlab





 

1.1.7 Convert a Laplace transfer function to an ordinary differential equation

Problem: Give a continuous time transfer function, show how to convert it to an ordinary differential equation. This method works for non-delay systems. The transfer function must be ratio of polynomials. For additional methods see this question at stackexchange



Mathematica