how to create constraints in fmincon
Show older comments
Hi all,
I have a dataset with two variables x and y as follows:
10 0.006 11 0.017 12 0.026 ...
50 0.003 51 0.002 52 0.001
I am trying to fit it with a nonlinear function with 4 parameters a, b, c, and d, of which c and d should be 10<c<52 and 10<d<52. The estimated y should be greater than 0. How can I create such constraints in fmincon? I was able to get the estimate using fminsearch. But many time, c and d and y do not meet the criterion.
lb and ub options in fminsearch are for y, not for parameters (right?) I am new with Matlab.
Thank you for warm support!
Rdu
1 Comment
Yu Jiang
on 4 Aug 2014
- In the function fmincon (see documentation), the input arguments lb and ub are in fact the lower and upper bound for the decision variables a, b, c, d, but not for the output y. If you need to keep y as a non-negative number, you may need to impose that constraint by choosing appropriate coefficient matrices Aeq and Beq.
- It would be helpful if you can provide more details regarding the nonlinear function you are using and the objective function that you are minimizing by using fmincon.
- I also wonder if you have tried to use the Curve Fitting Toolbox (see documentation) , which seems to be more suitable to be used here than fmincon.
-Yu
Accepted Answer
More Answers (1)
Rdu
on 5 Aug 2014
0 votes
1 Comment
Rajalekshmi kishhore
on 20 Apr 2017
can we have a separate function for linear constraint as was done for nonlinear constrint.if not how to mention sum linear constraint
Categories
Find more on Linear Programming and Mixed-Integer Linear Programming 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!