quadratic term in the objective function
조회 수: 2 (최근 30일)
이전 댓글 표시
I was trying to use MATLAB to implement an MPC algorithm and have trouble describing the objective function.
Say I want to get a summation
, where Q is a weight matrix.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/240709/image.png)
I want to use a matrix X in
. Each row represents the state of the system at a discrete time step and the dimension of the state is n.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/240710/image.png)
I need a compact notation without indexing because I want to directly include it in a objective function in CVX.
Only thing I can come up with is to use trace(
). It should work as the diagonal elements of
) are exactly what I want. But I am wondering if there is a better way to formulate it, as the methond I used computes some prudct that I won't use.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/240711/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/240712/image.png)
Thank you.
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Get Started with Optimization Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!