Which solver can be used for a non linear curve fitting with some variables being constrained to integers?
3 views (last 30 days)
Show older comments
Thanigaivel Raja T
on 23 Aug 2016
Edited: Thanigaivel Raja T
on 28 Aug 2016
I have a non linear curve fitting problem, say e^(x1+x2)-y=0, where x1,x2 are variables and y is the data against which fitting is done. Here x1 should be an integer and x2 can be a non integer. Which solver can handle such problems?
0 Comments
Accepted Answer
Alan Weiss
on 23 Aug 2016
If you really have the equation you gave as an example, then I would use
x = x1 + x2
meaning just fit a continuous x variable, and afterwards take
x1 = floor(x);
x2 = x - x1;
If, however, you have a general nonlinear fit with a variable constrained to be integer-valued, then the first thing that I would try is to fit it using any method you like, such as lsqcurvefit, but with no integer constraint. Then I would solve a set of problems with the integer variable set to various values close to the continuous solution.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
7 Comments
Walter Roberson
on 27 Aug 2016
Why is x(2)=3 a better solution than x(2)=1 or x(2)=2 ? All three of those lead to the same basic x(1) = 2 * log(5) - x(2) which meets the constraint on x(1) provided x(2) is no more than 3. There is no way for ga to tell the solutions apart.
If you are wanting to minimize x(1) such that exp(x(1)+ z(x(2)))-25=0 then you should be using gamultiobj and using x(1) as one of the objectives and (exp(x(1)+ z(x(2)))-25).^2 as your other objective.
More Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!