Find minimum of multi-variable function on fixed interval with additional parameter inputs
Show older comments
Hello all,
I would like to find the minimum of a family of functions on a fixed interval.
function yx = test_function(x,xin2)
a=xin2(1);
b=xin2(2);
c=xin2(3);
yx = abs((x(1)*x(2))/4 + ((x(1)^2*x(2)^2)/a + (x(1)*x(2))/b - 1/4)^(c) + 1/2)+x(3);
Thus, I would like to find the minimum of yx (which is determined by x(1), x(2) and x(3)) for a given set of values for a,b,c.
As I would like to repeat this exercise for a large number of combinations of a,b,c I would like to be able to change these automatically in a loop.
xin2=[16,4,1/2];
lb = [0 0 0];
ub = [1 1 1];
f=@test_function;
[x, fval] = fmincon(f(x,xin2), [rand(), rand(), rand()], A, b, Aeq, Beq, lb, ub)
The error message I get:
Error using optimfcnchk (line 101)
FUN must be a function, a valid character vector expression, or an inline function object.
Error in fmincon (line 415)
funfcn = optimfcnchk(FUN,'fmincon',length(varargin),funValCheck,flags.grad,flags.hess,false,Algorithm);
Error in Untitled2 (line 51)
[x, fval] = fmincon(f(x,xin2), [rand(), rand(), rand()], A, b, Aeq, Beq, lb, ub)
Can someone help me?
Kind regadrs,
Tom
Accepted Answer
More Answers (0)
Categories
Find more on Linear Algebra in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!