Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
find minima of 2d function

Subject: find minima of 2d function

From: Peter Schreiber

Date: 14 Sep, 2008 19:24:02

Message: 1 of 2

Hi guys,
I have a function f(x,y) sampled at a grid generated
with meshgrid and I would like to calculate the minima.
I know from the function that there can only be one or two minima.

What would be the most elegant way of calculating the minima? I assume I could calculate the 1st and 2nd derivative and look where the 1st derivative is zero, but the 2nd is not. But how can this be done in matlab?

Best Regards,
Peter

Subject: find minima of 2d function

From: Bruno Luong

Date: 15 Sep, 2008 07:18:02

Message: 2 of 2

"Peter Schreiber" <schreiber.peter15@gmail.com> wrote in message <gajoci$4jf$1@fred.mathworks.com>...
> Hi guys,
> I have a function f(x,y) sampled at a grid generated
> with meshgrid and I would like to calculate the minima.
> I know from the function that there can only be one or two minima.


>
> What would be the most elegant way of calculating the minima? I assume I could calculate the 1st and 2nd derivative and look where the 1st derivative is zero, but the 2nd is not. But how can this be done in matlab?
>

The second derivative is a symmetric matrix, that has two eigen values. At the minimum, both of those must be >=0. I do not aware any theorem that states the second derivative is not (zero) at the minimum. And beside that, the condition on first and second derivatives are necessary conditions on the text book and not sufficient in general. They becomes sufficient only when some assumption on the function are known such as convexity, etc... Which you haven't tell us.
  
Wait, first decide what is available to you. If you can evaluate the function and its gradient, the best is to plug it in the mnimizer such as fminunc (optimization toolbox).

If all you have is the function on grid points, then you won't do much better than a naive search over all values. If your function is smooth enough, you might refine the result with a spline approximation for example.

Bruno

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us