I am simulating Nonlinear MPC for nonholonomic mobile robot. I have to create references trajectory for it as: line-shape, circular shape, and 8-shape... With model of mobile robot: input as u=(v,w) with v-velocity, w-angular velocity. output as X=[x,y,theta]. To calculate cost funtion = (x-x_ref)^2+(y-y_ref)^2+(theta-theta_ref)^2+lamda*u1^2+lamda*u2^2. If you have the sample code on matlab/simulink, you will share for me.