How to input the following optimization into matlab so that can be sovled?! [URGENT]

1 visualización (últimos 30 días)
I have the following min square opt with a bit complicated equation to put in. I don't know the mathematical induction/function that can solve that properly, pls help.
min Σ ((a-b)^2) s.t. c>0
where b=inv(d*e)*(inv(f*e)+(g'*inv(c)*g))*(inv(f*e))*h+g'*inv(c)*h)
p.s. where all variable except f are all matrix p.s. I got stuck as I want to solve c but cannot make it into the equation. Please shed some light, thanks.
Greg

Respuestas (1)

Nick Hobbs
Nick Hobbs el 4 de Ag. de 2015
One way to input a minimization problem into MATLAB is with the function fmincon. 'fmincon' is used to minimize a function with a set of constraints. For your equation, the first step would be to define all of your other variables (a, b, d, e, f, and g).
Second, define an anonymous function based on your equation which should look like the following.
functionToOptimize = @(c) a - (inv(d*e)*(inv(f*e)+(g'*inv(c)*g))*(inv(f*e))*h+g'*inv(c)*h);
Then your call to 'fmincon' should look like the following.
fmincon(myFunctionToOptimize, 0, [], [], [], [], 0, Inf)
This statement says you are going to ignore a few of the constraints 'fmincon' can provide, and simply bound it over [0, Inf) with your initial guess as 0.
The documentation for 'fmincon' also includes additional examples.

Community Treasure Hunt

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

Start Hunting!

Translated by