How to input the following optimization into matlab so that can be sovled?! [URGENT]
1 view (last 30 days)
Show older comments
Ka Chung Cheng on 31 Jul 2015
Commented: Walter Roberson on 4 Aug 2015
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
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.
Nick Hobbs on 4 Aug 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.
Find more on Problem-Based Optimization Setup in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!