Get transfer function from state space
I think the answer should be \$G(s) = \frac{1}{(s+1)^2}\$, but I haven't checked it with Matlab yet. That should be

A = [0 1 0 0 0; 0 0 1 0 0; 0 -1 -2 0 0; 0 0 0 -2 0; 0 0 0 0 -3];
B = [0; 0; 1; 1; 0];
C = [0 1 0 0 1];
D = 0;
tf(ss(A,B,C,D))


Since there are quite a lot of zeros in your matrices, the formula \$G(s) = C (sI-A)^{-1}B\$ is not as daunting to compute by hand. Since \$C = \begin{bmatrix} 0 &amp; 1 &amp; 0 &amp; 0 &amp; 1\end{bmatrix}\$, you only care about the second and the fifth row of \$(sI-A)^{-1}\$. Since \$B=\begin{bmatrix} 0 &amp; 0 &amp; 1 &amp; 1 &amp; 0 \end{bmatrix}^T\$, you only care about the third and the fourth column of \$(sI-A)^{-1}\$. The other values in \$(sI-A)^{-1}\$ will get multiplied by zero. This means that you only need to compute four elements of \$(sI-A)^{-1} = \frac{adj(sI-A)}{det(sI-A)}\$:
$$
\begin{aligned}
G(s)
&amp; = C \frac{adj(sI-A)}{det(sI-A)} B \\
&amp; = \begin{bmatrix} 0 &amp; 1 &amp; 0 &amp; 0 &amp; 1\end{bmatrix}
\frac{
\begin{bmatrix}
\bullet &amp; \bullet &amp; \bullet &amp; \bullet &amp; \bullet \\
\bullet &amp; \bullet &amp; \theta_1&amp; \theta_2&amp; \bullet \\
\bullet &amp; \bullet &amp; \bullet &amp; \bullet &amp; \bullet \\
\bullet &amp; \bullet &amp; \bullet &amp; \bullet &amp; \bullet \\
\bullet &amp; \bullet &amp; \theta_3&amp; \theta_4&amp; \bullet
\end{bmatrix}}
{s(s+1)^2(s+2)(s+3)}
\begin{bmatrix} 0 \\ 0 \\ 1 \\ 1 \\ 0\end{bmatrix}
\end{aligned}
$$
The four elements that you need to compute are elements of an adjugate matrix. The first element is
$$
\theta_1 = (-1) det(
\begin{bmatrix}
s &amp; 0 &amp; 0 &amp; 0\\
0 &amp; -1 &amp; 0 &amp; 0\\
0 &amp; 0 &amp; s+2 &amp; 0\\
0 &amp; 0 &amp; 0 &amp; s+3
\end{bmatrix}
)
= s(s+2)(s+3)
$$
The other \$\theta\$s are zero, since there is either a zero row or a zero column in the 4 by 4 matrix of which you need to compute the determinant.

The transfer function is then equal to
$$
G(s) = \frac{s(s+2)(s+3)}{s(s+1)^2(s+2)(s+3)} = \frac{1}{(s+1)^2}
$$