constrained optimization with Matlab, symbolic function
Show older comments
Hello, I want to perform a simple optimization in Matlab
syms f(x,a) x a n
over
Max
Max
such that
and for each i 

and n are known I dont know how to define the constraints on Matlab and the Max optimization
Thanks
Answers (1)
If your function f is symbolic, you first have to convert it to a numerical function by using "matlabFunction".
k_tot = ...;
a = ...;
x = ...;
f = @(x,a) ...;
obj = @(k) sum(k.*f(x,a).^k)
Aeq = ones(n,1);
beq = k_tot;
lb = ones(n,1);
ub = inf(n,1);
k0 = k_tot/n*ones(1,n)
k = fmincon(obj,k0,[],[],Aeq,beq,lb,ub)
Categories
Find more on Nonlinear Optimization 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!