Obtaining value of cost function from LQR?

Is there anyway to actually extract the value of the cost function from LQR? -thanks

 Accepted Answer

Raj
Raj on 22 Apr 2019
Are you making a model in simulink or script in MATLAB? In my case I have made a SImulink closed loop model with LQR controller in a "Matlab function" block as a coder.extrinsic function. Another function block computes the value of cost function at each sample of time and saves it in workspace as an array/time series. At the end of simulation I just take sum of all the elements of the array which gives the cost function for a particular combination of "Q" and "R" weight matrices.

More Answers (0)

Products

Release

R2019a

Asked:

on 21 Apr 2019

Answered:

Raj
on 22 Apr 2019

Community Treasure Hunt

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

Start Hunting!