Can anyone please tell me how can I use inbuilt Matlab function "Integral" or "quadl" for calculating the scalar quadratic cost function. J(x,t)=int​egral(x'(t​)Qx(t))dt.

2 次查看(过去 30 天)
the cost function is J(x,t)=integral(x'(t)[Q+KRK]x(t))dt. tau=0 to 0.6
Following code says better what exactly I am trying to figure out.
I dont know how to bring in the dependent term x(t) while using function integral or quadl.
%%%%code
syms x
Q=eye(4);
K_new=[ 0.5 1 0.5 0.5];
R=1;
f = @(t,K) x(t)'.*(Q+K'.*R.*K).*x(t)
QQ = integral(@(x)f(t,K_new),0,0.6)
I know that representing x(t), considers x as a indexed variable which is not what I mean. x(t) is a dependent variable with respect to t (x is a time varying variable). Please see that J(x,t) is a common quadratic cost function associated with LQR problems. Please tell me whether I can use Matlab inbuilt function to solve or to get an approximate solution for the cost function.
Many many thanks for your valuable time in advance

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Numerical Integration and Differentiation 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by