IF you are trying to solve for p1,p2,p3,p4,p5, you CANNOT do it with fminbnd. fminbnd ONLY solves problems with aSINGLE unknown.
IF you are trying to solve for a SYMBOLIC minimum as a function of x, where p1,p2,p3,p4,p5 are all left as symbolic (and therefore unknown) then again, you cannot do this, because fminbnd CANNOT solve symbolic problems.
IF those variables (p1,...p5) have values, and you want to solve for x which yields a minimum, then they need to be assigned.
Finally, IF you are seriously trying to solve for a minimum of a 4th degree polynomial, with known coefficients, and you are trying to use fminbnd, WHY IN THE NAME OF GOD AND LITTLE GREEN APPLES WOULD YOU DO IT THAT WAY????????
Calc 101: Differentiate the polynomial. Then use roots to find the zeros of the derivative polynomial. Throw away the roots that were found outside of your region of interest. Choose the smallest function value the original polynomial yields at the remaining roots. Compare that to the value of the polynomial at the endpoints of the interval of interest, and take the smaller result.
Note that the above scheme will take about 4 lines of code, and will be quite efficient. This scheme will yield the true minimum of the polynomial over that interval. It will not be subject to starting values, or convergence issues for an iterative scheme like fminbnd.
Best Answer