MPC toolbox: implementation of default cost function

조회 수: 11 (최근 30일)
Renate
Renate 2022년 7월 2일
댓글: Renate 2022년 7월 3일
Where can I find the code of the default cost function in the Model Predictive Control toolbox?
I want to make a custom cost function, but I doubt I'd be able to do that from scratch. The easiest way to tackle this is probably to copy the code for the default cost function and edit that code, but I cannot find it anywhere. I have found the documentation on how to specify a custom cost function, but I'd rather take a look at the code for the default first before I build something from scratch.
Some context: I'm building a controller that penalizes a decrease in the MV's (Manipulated Variables), but doesn't penalize an increase in the MV's. For the weights, I can only tweak the "Weights.MVRate", which of course impacts both equally.
Thanks,
Renate

채택된 답변

Sam Chak
Sam Chak 2022년 7월 3일
There shoud be a file called mpc_costcomputation. Please check if this is what you are looking for.
edit mpc_costcomputation
  댓글 수: 1
Renate
Renate 2022년 7월 3일
This is indeed the file I was looking for, though a bit hard to find since for some reason the folder was not on the matlab path. Apparently it is located in:
C:\Program Files\MATLAB\R2022a\toolbox\mpc\mpc\@mpc\private
Thank you very much!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Refinement에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by