MATLAB: Which solver can be used for a non linear curve fitting with some variables being constrained to integers

integer variablesMATLABnon linear curve fittingoptimizationOptimization Toolboxsolver

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?

Best Answer

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