Optimisation using fmincon (constraints)

1 回表示 (過去 30 日間)
R Hebi
R Hebi 2020 年 3 月 7 日
コメント済み: Ameer Hamza 2020 年 3 月 8 日
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

回答 (1 件)

Ameer Hamza
Ameer Hamza 2020 年 3 月 7 日
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 件のコメント
R Hebi
R Hebi 2020 年 3 月 8 日
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 2020 年 3 月 8 日
R Hebi, yes, that's correct.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeGet Started with Optimization Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by