Minimization of function. Plz Help.
Infos
Cette question est clôturée. Rouvrir pour modifier ou répondre.
Afficher commentaires plus anciens
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.
Réponses (2)
Matt Tearle
le 28 Juil 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.
the cyclist
le 28 Juil 2011
0 votes
Do you have the Optimization Toolbox? The function fmincon() will do what you want.
Cette question est clôturée.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!