Optimisation using fmincon (constraints)

2 views (last 30 days)
R Hebi
R Hebi on 7 Mar 2020
Commented: Ameer Hamza on 8 Mar 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

Answers (1)

Ameer Hamza
Ameer Hamza on 7 Mar 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 Comments
Ameer Hamza
Ameer Hamza on 8 Mar 2020
R Hebi, yes, that's correct.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by