### 1.1 Creating tf and state space and diﬀerent Conversion of forms

#### 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
 .syntaxhighlighter textarea {font-size: 14px !important;} Out= TransferFunctionModel[{      {{5*(1 + s)*(2 + s)}},      s*(4 + s)*(6 + s)}, s]

##### 1.1.1.2 Matlab
 .syntaxhighlighter textarea {font-size: 14px !important;} num/den =     5 s^2 + 15 s + 10    -------------------    s^3 + 10 s^2 + 24 s

##### 1.1.1.3 Maple
 .syntaxhighlighter textarea {font-size: 14px !important;} $\text {tf} = \left [ {\begin {array}{c} {\frac {5\,{s}^{2}+15\,s+10}{{s}^{3}+10\,{s}^{2}+24\,s}}\end {array}} \right ]$ .syntaxhighlighter textarea {font-size: 14px !important;} $5*s^2+15*s+10$ .syntaxhighlighter textarea {font-size: 14px !important;} $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 deﬁned by the transfer function $H(s)=\frac {5s}{s^{2}+4s+25}$

##### 1.1.2.2 Mathematica
 .syntaxhighlighter textarea {font-size: 14px !important;} .syntaxhighlighter textarea {font-size: 14px !important;} ##### 1.1.2.3 Matlab
 .syntaxhighlighter textarea {font-size: 14px !important;} A =     -4   -25      1     0 B =      1      0 C =      5     0 D =      0

##### 1.1.2.4 Maple
 .syntaxhighlighter textarea {font-size: 14px !important;} $\left [{\begin {array}{cc} 0 & 1 \\ -25 & -4 \end {array}} \right ]$ .syntaxhighlighter textarea {font-size: 14px !important;} $\left [ {\begin {array}{c} 0\\ 1\end {array}} \right ]$ .syntaxhighlighter textarea {font-size: 14px !important;} $\left [ {\begin {array}{cc} 0&5\end {array}} \right ]$ .syntaxhighlighter textarea {font-size: 14px !important;} $\left [ {\begin {array}{c} 0\end {array}} \right ]$

##### 1.1.2.5 problem 2

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

 Mathematica .syntaxhighlighter textarea {font-size: 14px !important;} $\left ( {\begin {array}{cc|c|c} 0 & 1 & 0 \\ -1 & -1 & 1 \\ \hline 1 & 1 & 0 \\ \end {array}} \right )_{}$ .syntaxhighlighter textarea {font-size: 14px !important;} $\frac {s+1}{s^2+s+1}$

 Matlab .syntaxhighlighter textarea {font-size: 14px !important;} .syntaxhighlighter textarea {font-size: 14px !important;} .syntaxhighlighter textarea {font-size: 14px !important;} .syntaxhighlighter textarea {font-size: 14px !important;}

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

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

 Mathematica .syntaxhighlighter textarea {font-size: 14px !important;} Matlab .syntaxhighlighter textarea {font-size: 14px !important;} Maple .syntaxhighlighter textarea {font-size: 14px !important;} #### 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 deﬁned by $H(s)=\frac {1+s}{s^{2}+s+1}$ Use sampling period of 0.1 seconds.

 Mathematica .syntaxhighlighter textarea {font-size: 14px !important;} .syntaxhighlighter textarea {font-size: 14px !important;} .syntaxhighlighter textarea {font-size: 14px !important;} .syntaxhighlighter textarea {font-size: 14px !important;} .syntaxhighlighter textarea {font-size: 14px !important;} Matlab .syntaxhighlighter textarea {font-size: 14px !important;} .syntaxhighlighter textarea {font-size: 14px !important;} .syntaxhighlighter textarea {font-size: 14px !important;} #### 1.1.5 Convert diﬀerential equation to transfer functions and to state space

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

 Mathematica .syntaxhighlighter textarea {font-size: 14px !important;} .syntaxhighlighter textarea {font-size: 14px !important;} Matlab .syntaxhighlighter textarea {font-size: 14px !important;} .syntaxhighlighter textarea {font-size: 14px !important;} .syntaxhighlighter textarea {font-size: 14px !important;} .syntaxhighlighter textarea {font-size: 14px !important;}

 Maple .syntaxhighlighter textarea {font-size: 14px !important;} $\frac {1}{3{s}^{2}+2\,s+1}$ .syntaxhighlighter textarea {font-size: 14px !important;} \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 .syntaxhighlighter textarea {font-size: 14px !important;} Matlab .syntaxhighlighter textarea {font-size: 14px !important;} .syntaxhighlighter textarea {font-size: 14px !important;}

#### 1.1.7 Convert a Laplace transfer function to an ordinary diﬀerential equation

Problem: Give a continuous time transfer function, show how to convert it to an ordinary diﬀerential 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 .syntaxhighlighter textarea {font-size: 14px !important;} .syntaxhighlighter textarea {font-size: 14px !important;}