How to apply constraints for polynomial to polynomial parameters? I have a polynomial that I use for least squares regression on experimental data to find coefficients $a_0,a_1,a_2$:
$$f(x)=a_0+a_1 x+a_2 x^2$$
I have a constraint for $f(x)$, e.g. :
$$Y<f(x)<Z$$
and I know the range of the variable $x$. How do I apply this knowledge to constrain parameters $a_0$,$a_1$,$a_2$? 
My solution was to create a linearly spaced vector of values in the allowed range of $x$ and supplying them to the polynomial. The result of the polynomial was then checked against the constraint. Is there a better way to do this? I used Matlab and fmincon function.

If you're using a computer, then all you really need to check are the two end points of your range, and if $x=-\frac{a_1}{2a_2}$ is within your range then you need to check that too.
In fact, that's probably the easiest thing to do by hand as well.
The reason that this works is that $x=-\frac{a_1}{2a_2}$ is the extremum point of your parabola, and on either side of that point the function is monotonic.
