Controllability matrix for a system is given by
Where A is nxn constant matrix and B is n by m constant matrix.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/257723/image.png)
The error occurred because, In your script, you declared A and B matrix with variables as elements. ctrb function works for only constant matrices.