## MATLAB: How to fit a polynomial with inequality constraints on the coefficients

constraintscurve fitting

I am trying to fit some data to the functional form:

f(x)=a(1)*exp(a(2)*x)+a(3)*(x^2)+a(4)*x-a(1)

I want to:

- force a(1)*a(2)+a(4) to have a maximum value of 10
- force f(x) to be positive at all values of x>0

I was trying to use lsqcurvefit, but it seems the function does not allow inequality constraints.

`x_data=[1.264000000000002.040000000000003.544000000000004.760000000000006.260000000000007.6440000000000011.772000000000013.688000000000018.368000000000018.3680000000000]y_data=[8.3600380000000014.000604000000032.591938000000047.097172000000050.773364000000046.991136000000041.142866000000037.619300000000039.491840000000039.0617800000000]`

Thanks!

## Best Answer