how to create constraints in fmincon
이전 댓글 표시
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
Yu Jiang
2014년 8월 4일
- 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
채택된 답변
추가 답변 (1개)
Rdu
2014년 8월 5일
0 개 추천
댓글 수: 1
Rajalekshmi kishhore
2017년 4월 20일
can we have a separate function for linear constraint as was done for nonlinear constrint.if not how to mention sum linear constraint
카테고리
도움말 센터 및 File Exchange에서 Choose a Solver에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!