How can i solve this optimization problem?

2 次查看(过去 30 天)
Hi,
My cost function is:
clear all
clc
syms delta_Uk
F = rand(4,5);
Xf = rand(5,1);
phi = rand(4,2);
Q = rand(4,4);
R_bar = rand(2,2);
Rs = rand(4,1);
YY = F * Xf + phi * delta_Uk;
J = (transpose(Rs - YY)) * Q * (Rs - YY) + (transpose(delta_Uk)) * R_bar * delta_Uk;
Which command / optimization technique may be used to find delta_Uk which make J minimum? There is no contraint on this problem.
Thanks,

采纳的回答

Bjorn Gustavsson
Bjorn Gustavsson 2021-8-31
Best route might be to properly differentiate J with respect to delta_Uk and solve the normal equations and find an analytical solution to that system of equations, and check/verify that it is the global minimum - this is after all some kind of 2-D quadratic equation. It should be possible to solve with the symbolic tools available too for general forms of the constant matrices if you define those variables as arrays:
syms F [4 5]
and so on. For a numerical solution you simply have to define YY and J as functions which you can do like this:
F = rand(4,5);
Xf = rand(5,1);
phi = rand(4,2);
Q = rand(4,4);
R_bar = rand(2,2);
Rs = rand(4,1);
YY = @(delta_Uk) F * Xf + phi * delta_Uk;
J = @(dUk) (transpose(Rs - YY(dUk))) * Q * (Rs - YY(dUk)) + (transpose(dUk)) * R_bar * dUk;
This gives you your cost-function J as a function-handle which you can treat pretty much identically like ordinary matlab-function. To minimize it you can simply call fminsearch:
best_dUk = fminsearch(J,[1;2])
Which should give you the optimal value for delta_Uk.
HTH
  3 个评论
Volkan Yangin
Volkan Yangin 2021-8-31
Finally, i want to ask another question. If we have constraints, is there any alternative way instead of fminsearch?
Bjorn Gustavsson
Bjorn Gustavsson 2021-8-31
My pleasure.
You have at least two FEX-submissions that helps you with that problem: fminsearchbnd and minimize. Then you have the optimisation-toolbox functions fmincon (and possibly lsqnonlin if you can differentiate your quadratic equation into normal-equations).

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Calculus 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by