How can I add constraints in a solution of a function?
Show older comments
Hi everyone,
I would like to solve the following function by adding two constraints.
S=randn(6,6); y=randn(6,1); ONE = ones(6,1); rft=randn(1,1); K = randn(1,1);
x = inv(S)*(y- ONE*rft)*0.1/sqrt(K);
I would like to include 2 additional constraints, -1<sum(x)<2 . I am not sure how I should use fmincon.
10 Comments
Walter Roberson
on 29 Oct 2018
What variable are you minimizing with respect to?
gsourop
on 29 Oct 2018
Bruno Luong
on 29 Oct 2018
What S has anything to do then in your command
x = inv(S)*(y- ONE*rft)*0.1/sqrt(K)
gsourop
on 29 Oct 2018
Bruno Luong
on 29 Oct 2018
Edited: Bruno Luong
on 29 Oct 2018
You still haven't told us everything relevant: the cost function (return) and the constraint do not have K anywhere, yet you claim the algebraic solution has some expression which is ~ 1/sqrt(K).
Why?
Bruno Luong
on 30 Oct 2018
Edited: Bruno Luong
on 30 Oct 2018
And S is symmetric definite positive matrix?
I think it is much better if you give an complete and accurate description of your problem instead of hiding relevant information that you think it's not.
gsourop
on 30 Oct 2018
Bruno Luong
on 30 Oct 2018
Yes, even the sqrt() might return complex result.
gsourop
on 30 Oct 2018
Accepted Answer
More Answers (0)
Categories
Find more on Mathematics and Optimization in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!