Hi Sam,
I was hoping that the OP would show a little more effort before giving the answer. Anyway ...
The code should be modified to use the 'all' input to coeffs so as to return the 0 coefficients as well. That way we can use dencoeff as well, which is what we'd want in general, and not return numeric A and D matrices
syms s alpha beta_1 beta_2
Gp = ((alpha + beta_2)*s^2 + 3*beta_1*s + 9*alpha)/(s^3 + 0*s^2 + 9*s + 0)
Gp =
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1557839/image.png)
[num, den] = numden(Gp)
num = ![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1557844/image.png)
den = ![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1557849/image.png)
[numcoeff, numterm] = coeffs(num, s, 'all')
numcoeff = ![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1557854/image.png)
numterm = ![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1557859/image.png)
[dencoeff, denterm] = coeffs(den, s, 'all')
dencoeff = ![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1557864/image.png)
denterm = ![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1557869/image.png)
[A, B, C, D] = tf2ss(numcoeff, dencoeff)
simplify(C*inv(s*eye(3)-A)*B + D)
ans =
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1557889/image.png)