Info

1 view (last 30 days)
Pankaj Dey on 26 Mar 2015
Closed: MATLAB Answer Bot on 20 Aug 2021
My code is as follows:
f = @(x)(((0.0002*((x(1)^2)*x(2)/9.81)^2)-(0.876*(x(1)^2)*x(2)/9.81)/(5.2868+(3310/((x(1)^2)*x(2)/9.81))))/(240.59*(x(1)^3)*(x(2)^2)));
[x,fval] = fminsearch(f,[1480, 0.14]);
Matlab command window's response:
Exiting: Maximum number of function evaluations has been exceeded - increase MaxFunEvals option. Current function value: -1551659114344406700000000000000000000000.000000

John D'Errico on 26 Mar 2015
So, you don't think this function might be unbounded? -1.5517e+39 is a really big negative number.
Increasing the iteration limit will not help, just get you closer to -inf.. But again, -1.5517e+39 is reasonably close to -inf. How much more negative do you want it to be?
I think fminsearch is working quite well here. You just don't like the answer it gives you, but that means that you have a poor choice of objective function.
Try plotting the surface. For example, try this:
f = @(x1,x2)(((0.0002*((x1.^2).*x2/9.81).^2)-(0.876*(x1.^2).*x2/9.81)./(5.2868+(3310./((x1.^2).*x2/9.81))))./(240.59*(x1.^3).*(x2.^2)));
ezsurf(f)
Do you honestly think this function is a good choice to optimize?