Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

Minimization of function. Plz Help.

2 Ansichten (letzte 30 Tage)
Kim
Kim am 28 Jul. 2011
Geschlossen: MATLAB Answer Bot am 20 Aug. 2021
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.

Antworten (2)

Matt Tearle
Matt Tearle am 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.

the cyclist
the cyclist am 28 Jul. 2011
Do you have the Optimization Toolbox? The function fmincon() will do what you want.

Diese Frage ist geschlossen.

Community Treasure Hunt

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

Start Hunting!

Translated by