Error running optimization. Inputs must be a scalar and a square matri I am trying to use fminunc using optimtool. But i got the error Error running optimization. Inputs must be a scalar and a square matrix. this is the function i typed in the editor. function F = fun(x) F = -0.2662*x^6 + 48.19*x^5 - 3424.2*x^4 + 121708*x^3 - 2*e^6*x^2 + 2*e^7*x - 6*e^7; end i am not sure if this is a simple problem in matlab..i just want to optimize it using fminunc..i am new to matlab and there are a lot of things i do not understand.can you help me?