Is there a way, given a set of values $(x,y)$, to find a cubic polynomial $f(x)$ that fits the values?
My cubic polynomial is defined as
$c_0 + c_1x +\frac {1}{2} c_2 x^2 +\frac {1}{6}c_3 x^3$
One condition being each co-efficient in above equation can only take values in between certain range (min, max) predefined for each coefficient.
I have tried with Least squares error algorithm to fit the points to the polynomial but I am not sure how to include the conditions for allowed range for coefficients in the algorithm.
What approach should I follow and which algorithms allow this?
Assuming that you have $n$ data points $(x_i,y_i)$, you want to minimize $$SSQ=\sum_{i=1}^n\left( c_0+c_1x_i+\frac 12 c_2x_i^2+\frac 13 c_3x_i^3-y_i\right)^2$$ subject to constraints $a_i\leq c_i\leq b_i$.
This is clearly an optimization problem with only bound constraints. Have a look here for doing it using Matlab.
Edit
By the way, if you have access to a simple optimizer (unable to handle constraints), you could write $$c_i=a_i+\frac{b_i-a_i}{1+e^{-d_i}}$$ and use the $d_i$ as new unbounded variables. This switch the problem to a nonlinear regression.
Last : if you have access to a Fortran compiler, I could provide you a very simple and efficient subroutine solving the problem. Feel free to contact me (my e-mail address is in my profile).