Minimization of function. Plz Help.
Información
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
Mostrar comentarios más antiguos
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.
Respuestas (2)
Matt Tearle
el 28 de Jul. de 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
el 28 de Jul. de 2011
0 votos
Do you have the Optimization Toolbox? The function fmincon() will do what you want.
La pregunta está cerrada.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!