Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
Minimization of function. Plz Help.
조회 수: 2 (최근 30일)
이전 댓글 표시
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
답변 (2개)
Matt Tearle
2011년 7월 28일
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
the cyclist
2011년 7월 28일
Do you have the Optimization Toolbox? The function fmincon() will do what you want.
댓글 수: 0
이 질문은 마감되었습니다.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!