MATLAB: Applying a negative to the function to find the maximum

%fcalculationfunctionlive scriptmaximum

hello to find the maximum point in a curve I must use the negative function however this creates errors. My function is f = @(x)p1*x^4 + p2*x^3 + p3*x^2 + p4*x + p5 where does the minus sign precede the f? Thanks.

Best Answer

Hi,
your minus should span the entire function, i.e.
f = @(x) -(p1*x^4 + p2*x^3 + p3*x^2 + p4*x + p5);
Titus