title: how to maxima of a function in Matlab script file?
body: <p>I have a function to be optimized to find its maxima (using Matlab). The function part of the simulation model and hence it is stored in a Matlab script file. </p>
  
  <p>Note that in normal case of function usage, I can do the maximization using <strong><em>fminbnd</em></strong> command and then taking the negative of the function. Such that  </p>
  
  <blockquote>
    <p>g(x) = –f(x)</p>
  </blockquote>
  
  <p>e.g. </p>
  
  <pre><code>[x fval] = fminbnd(@(x)-tan(cos(x)),3,8)
  </code></pre>
  
  <p>But I am looking for a way to do find maxima using the (or -ve of function to find maxima) for a script function.</p>