Info
This question is closed. Reopen it to edit or answer.
Minimization of function. Plz Help.
2 views (last 30 days)
Show older comments
Maybe it can be easy, but please help. I am beginner in humble country.
R = (0.1 0 0.3;-0.2 -0.5 -0.1;0.15 0.2 -0.1]; (it can be changed)
[row,cols]=size( R );
f=ones(1,cols);
growth(R,f);
saved function to growth.m is
--------------------------------------
function g = growth(R, f)
[ro,co] = size( R );
T = R*0.01/0.15;
g = -sum(log(1+T(1:ro,:)*f'))/ro;
---------------------------------------
How can I minimize growth(R,f) with f(with given R)? Constraint is f1+|f2|+...+|fn|<=1
I want to iterate f=(f1,f2,f3,...,fn) like
f1=-1:0.01:1
f2=-1:0.01:1
f3=-1:0.01:1
...
Please help. very Thanks.
0 Comments
Answers (2)
Matt Tearle
on 28 Jul 2011
R = [1 2 3;4 5 6;7 8 9];
[row,cols] = size(R);
f = ones(1,cols);
fobj = @(x) growth(R,x);
opts = optimset('Algorithm','interior-point');
f = fmincon(fobj,f,[],[],[],[],[],[],@growthconstraints,opts)
This performs a constrained optimization on fobj which is growth(R,f) with R fixed (ie so a function of just f). The constraint is specified in growthconstraint.m:
function [c,ceq] = growthconstraints(x)
c = norm(x,1)-1;
ceq = 0;
This defines an inequality constraint (sum(f_j) <= 1) and a null equality constraint.
0 Comments
the cyclist
on 28 Jul 2011
Do you have the Optimization Toolbox? The function fmincon() will do what you want.
0 Comments
This question is closed.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!