constrained optimization with Matlab, symbolic function

Hello, I want to perform a simple optimization in Matlab
syms f(x,a) x a n
over 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

Respuestas (1)

Torsten
Torsten el 14 de Mayo de 2024
Editada: Torsten el 14 de Mayo de 2024
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)

Categorías

Preguntada:

el 14 de Mayo de 2024

Editada:

el 14 de Mayo de 2024

Community Treasure Hunt

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

Start Hunting!

Translated by