diff options
author | Yuan Xu <yuanxu@student.ethz.ch> | 2023-05-11 12:00:59 +0200 |
---|---|---|
committer | Yuan Xu <yuanxu@student.ethz.ch> | 2023-05-11 12:00:59 +0200 |
commit | feb6ec844cf2d0cdb07acd609615675141e2706a (patch) | |
tree | 1a411c04d693358a6ffc2d2a07e09bb819a8f6cc /templates/simulate.m | |
parent | Revert mistakenly pushed to master (diff) | |
download | mpc_pe-feb6ec844cf2d0cdb07acd609615675141e2706a.tar.gz mpc_pe-feb6ec844cf2d0cdb07acd609615675141e2706a.zip |
update previous filesyuanxu
Diffstat (limited to '')
-rw-r--r-- | templates/simulate.m | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/templates/simulate.m b/templates/simulate.m index 6100434..a5525f6 100644 --- a/templates/simulate.m +++ b/templates/simulate.m @@ -12,18 +12,15 @@ function [Xt,Ut,ctrl_info] = simulate(x0, ctrl, params) % Hint: you can access the control command with ctrl.eval(x(:,i)) Xt = [x0]; Ut = []; - x = x0 + x = x0; ctrl_info = []; - % obj = LQR(); for i = 1:params.model.HorizonLength [u, ctrl_info_] = ctrl.eval(x); - Ut = [Ut u]; + Ut = [Ut,u]; ctrl_info = [ctrl_info ctrl_info_]; x = params.model.A*x + params.model.B*u; - Xt = [Xt x]; + Xt = [Xt,x]; end plot_trajectory(Xt, Ut, ctrl_info, params); -% Ut = u; -% Xt = x; end
\ No newline at end of file |