Optimisation using fmincon (constraints)

1 visualización (últimos 30 días)
R Hebi
R Hebi el 7 de Mzo. de 2020
Comentada: Ameer Hamza el 8 de Mzo. de 2020
Hi,
I have a function I would like to optimize it but this function has multi varabiles (T & c2 )
The objectives is to identify the minimum V
I did the following
q = 30;
c1i = 5;
x0 = 0;
lb = 300;
[T,V] = fmincon(V,x0,A,b,Aeq,beq,lb,ub);
how can I insert the (c1o) constraint & work out the c2

Respuestas (1)

Ameer Hamza
Ameer Hamza el 7 de Mzo. de 2020
You can solve for multiple variables, but all of them need to be elements of x. See how in the following example. the objective function V is changed
q = 30;
c1i = 5;
c1o = 1; % HERE IS MY PROBLEM
c2 = 4; % HERE IS MY PROBLEM
A = [];
b = [];
Aeq = [];
beq = [];
x0 = [1 500 1];
lb = [-inf -inf -inf];
ub = [1.143 inf inf];
k1 = @(x) 7.0*(10^15)*exp(-15075/x);
k2= @(x) 2.86*(10^4)*exp(-5025/x);
V = @(x) q*(c1i-x(1))./(x(1)*k1(x(2))-x(3)*k2(x(2))); % c1o => x(1), T => x(2), c2 => x(3)
[T,V] = fmincon(V,x0,A,b,Aeq,beq,lb,ub);
  2 comentarios
R Hebi
R Hebi el 8 de Mzo. de 2020
Thinks
What if I want to add a linear equlaity constraint, such as
x(2)+x(3)=5
Is it like this ?
A = [0 1 1];
b = [5]
Ameer Hamza
Ameer Hamza el 8 de Mzo. de 2020
R Hebi, yes, that's correct.

Iniciar sesión para comentar.

Categorías

Más información sobre Get Started with Optimization Toolbox en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by