how to create constraints in fmincon
Ältere Kommentare anzeigen
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 Kommentar
Yu Jiang
am 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
Akzeptierte Antwort
Weitere Antworten (1)
Rdu
am 5 Aug. 2014
0 Stimmen
1 Kommentar
Rajalekshmi kishhore
am 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
Kategorien
Mehr zu Linear Programming and Mixed-Integer Linear Programming finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!