Dear all,
I met a problem, xmax = fminbnd(@(x)(f(x)), 0, 5) this line is ok, however, xmax = fminbnd(@(x)(-f(x)), 0, 5) get an error, if I use inline , xmax = fminbnd(inline(-f(x)), 0, 5), it is also ok, I don't know what is the problem. Could anyone give me the answer.
Thanks!
matlab2018a win7
clearvarssyms t xf = @(x)int(t*exp(-t^2),t, 0, x);xmin = fminbnd(f, 0, 5)fxmin = double( f(xmin) )xmax = fminbnd(@(x)(f(x)), 0, 5) %ok
xmax = fminbnd(inline(-f(x)), 0, 5) %ok
xmax = fminbnd(@(x)(-f(x)), 0, 5) %error
xmax = fminbnd(@(x)(f(x)*(-1)), 0, 5) %error
Best Answer