# How to formulate nonlinear optimization problem with large number of variables and constraints

2 views (last 30 days)
Karl Burkamp on 18 May 2021
Answered: Alan Weiss on 20 May 2021
Hello,
i have a problem formulating a nonlinear optimization problem with matlab and don't really know how to start or if i go the right approach.
I have a nonlinear equation looking like
with total of 10 variables --> x()
Then i have about 500 constraints with the same equation as above with fixed but different k, const.a, const.b and const.c.
I want to optimize so that i have best values for x(1) to x(10) to have best possible solution for k when inserting different const.a b and c.
Will the optimizer handle the fact that the expression in the log should not be negative? or does that have to be a constraint as well?
What is the best way to formulate it for the optimizer? I am even not sure if i described my problem properly.
I use Matlab 2019b
Best regards
Karl
##### 2 CommentsShowHide 1 older comment
Karl Burkamp on 20 May 2021
Hey Alan,
thanks for quick response.
Sorry if i did not express my problem properly.
I have a nonlinear equation like the one given above for that i hope will fit my Data in some way. I have 500 datasets for k, a, b and c. I now want to optimize x(1) to x(10) to fit all datasets k, a, b, c in the best way. So in the end i want to have the equation seen above --> k as function of a, b and c with best fitted constants x(1) to x(10).
Best regards
Karl

Alan Weiss on 20 May 2021
It sounds to me as if you want to fit an expression to data, possibly in a least-squares sense. For examples and details, see Nonlinear Least Squares (Curve Fitting). Maybe these examples from that section will help in some way: Nonlinear Least-Squares, Problem-Based, Nonlinear Data-Fitting Using Several Problem-Based Approaches, Nonlinear Data-Fitting, or Nonlinear Curve Fitting with lsqcurvefit.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation

R2019b

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!