The problem is that you are creating a nonconvex nonlinear problem, and fmincon simply fails to find a solution. You see this if you catch the problem flag from the optimizer call
[uopt,problem]=controller{x}
The model you create is extremely complex. Since you declare the dynamics using assignments, x(N) will be an enormously complex function of the input variables. The computational tree will really deep. It is much better if you declare the MPC problem in implicit prediction form (i.e., optimize over both x and u and connect them using equality constraints). See the YALMIP Wiki for details on MPC examples.
Having said that, it will still be nonlinear and nonconvex and most likely fmincon will struggle to find a solution. Start with N=1, and if that doesn't work, well...