8 views (last 30 days)

Hi, I have serios of multiple non-linear constraints and i am stuck how to write them in MATLAB, please help me out how to write the overall sum for n values. I have attached the problem below.

e.g. if phi and tau are the optimal variables which are x(1) and x (2) and the value of beta = 5,

Rn is the sumrate of main code and Rn' is the sumrate threshold value (10*1000) ,

function [c,ceq]=constraints(x)

c(1)=?

c(2)=?

c(3)=?

c(4)=sumrate(x)-10*1000

ceq=[];

end

how to erite the other constraints?

thank you in advance

xi
on 17 Sep 2019

Edited: Matt J
on 17 Sep 2019

You have 2n parameters, named X1,X2...Xn(for phi) and Xn+1...X2n (for tau).

You need to write the constraints in the vectorized format of Ax-b<0, where A is a matrix, b is a vector. The #rows of A as well as the length of b is determined by how many contraints you have, and the #columns is 2n (number of parameters).

In your case, the first three sets of constraints are linear constraints (total of 1+1+2n=2n+2). Your A matrix should have 2n+2 rows:

A(1,:)= [ones(1,n),zeros(1,n)];

A(2,:)= [zeros(1,n),ones(1,n)];

A=[A;-eye(2*n)];

b=[(1-beta);beta;zeros(2*n,1)]

xi
on 3 Oct 2019

Opportunities for recent engineering grads.

Apply Today
## 3 Comments

## Direct link to this comment

https://la.mathworks.com/matlabcentral/answers/480223-how-to-write-series-of-multiple-non-linear-constraints-for-optimization-using-fmincon-in-matlab#comment_745473

⋮## Direct link to this comment

https://la.mathworks.com/matlabcentral/answers/480223-how-to-write-series-of-multiple-non-linear-constraints-for-optimization-using-fmincon-in-matlab#comment_745473

## Direct link to this comment

https://la.mathworks.com/matlabcentral/answers/480223-how-to-write-series-of-multiple-non-linear-constraints-for-optimization-using-fmincon-in-matlab#comment_746681

⋮## Direct link to this comment

https://la.mathworks.com/matlabcentral/answers/480223-how-to-write-series-of-multiple-non-linear-constraints-for-optimization-using-fmincon-in-matlab#comment_746681

## Direct link to this comment

https://la.mathworks.com/matlabcentral/answers/480223-how-to-write-series-of-multiple-non-linear-constraints-for-optimization-using-fmincon-in-matlab#comment_746732

⋮## Direct link to this comment

https://la.mathworks.com/matlabcentral/answers/480223-how-to-write-series-of-multiple-non-linear-constraints-for-optimization-using-fmincon-in-matlab#comment_746732

Sign in to comment.