diff options
author | Nao Pross <np@0hm.ch> | 2023-05-24 16:29:40 +0200 |
---|---|---|
committer | Nao Pross <np@0hm.ch> | 2023-05-24 16:32:02 +0200 |
commit | 0105f2746c6dd8c3617f93fd3281f7e2708cae76 (patch) | |
tree | 5a630201702256df343dec6aca126bdd1bdc3349 /templates/traj_cost.m | |
parent | Take deliverables for uncontrained optimal control from npross (diff) | |
download | mpc_pe-0105f2746c6dd8c3617f93fd3281f7e2708cae76.tar.gz mpc_pe-0105f2746c6dd8c3617f93fd3281f7e2708cae76.zip |
Take deliverables for from LQR to MPC from yuanxu
According to table 7 that is
- lqr_maxPI
- traj_cost
- MPC
- MPC/eval (contained in MPC.m)
Diffstat (limited to 'templates/traj_cost.m')
-rw-r--r-- | templates/traj_cost.m | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/templates/traj_cost.m b/templates/traj_cost.m index 7e0b443..57566c9 100644 --- a/templates/traj_cost.m +++ b/templates/traj_cost.m @@ -8,4 +8,10 @@ function J_Nt = traj_cost(Xt,Ut,Q,R) % YOUR CODE HERE + J_Nt=0; + for i=1:length(Xt(1,:))-1 + a= Xt(:,i)'*Q*Xt(:,i); + b= Ut(:,i)'*R*Ut(:,i); + J_Nt=J_Nt+a+b; + end end
\ No newline at end of file |