Exactly Francis, I am trying that thing!
for t = 1:Nsim
controller.fixvar('x', 1, x(:,t));
par = struct('xsp', [Xunit_2(t:t+Nt-1); Yunit_2(t:t+Nt-1)], 'Q', Q); -----------Line 1
controller.solve();
fprintf('Step %d: %s\n', t, controller.status);
u(:,t) = controller.var.u(:,1);
x(:,t+1) = controller.var.x(:,2);
controller.saveguess();
end
Since I want to track a trajectory in x and y, x in code is a initialised as
x = NaN(Nx, Nsim + 1); where Nx = 2
So within the loop, I keep updating the reference (Xunit_2 and Yunit)2 matrices). But the output trajectory produced is different from reference trajctory.
Can you look into the loop thing?
Thanks a lot!!!!