How can i know through MATLAB tool that given function is convex or not?

Dear ALL, is there any way to find the function is convex or not in MATLAB?As an example i am giving you the following two functions in order to check which one is convex.
These are well known functions used in robust estimation.How can i show through matlab tool the function is convex or not?
Thanks

 Accepted Answer

Look at the number of zeros of derivatives and the signs of derivatives. Repeat with derivatives of that, as many times as necessary to figure out the rule.

6 Comments

Thank you for your answer. I did not understand your answer.Could you please explain your answer with respect to my given examples
Take the first derivative of a function. How many zeros does the derivative have? 0? 1? more than 1? What does each of those imply about the function? Is the sign of the first derivative always positive, always negative, always zero, some negative and some positive?
Take the second derivative of a function. How many zeros does the derivative have? 0? 1? more than 1? What does each of those imply about the original function? Is the sign of the second derivative always positive, always negative, always zero, some negative and some positive?
Take the third derivative... and so on.
As you keep going along this path, you will be able to find a difference between convex and non-convex functions.
Dear Roberson How i will find the number of zeros.Should i equate the first derivative to zeros and then find values of variable x to know either it is zero or not?Am i right?
symbolic toolbox, solve() for the derivative equal 0.

Sign in to comment.

More Answers (1)

If your function has a second derivative, it is convex if and only if that second derivative is always non-negative. If the second derivative is unobtainable, a function is convex if any chord connecting two points on the curve always lies on or above the portion of the curve between the two points. Look at this site for a definition:
https://en.wikipedia.org/wiki/Convex_function
Your f2 function is certainly not convex as can be determined by just looking at it. A simple plot reveals that f1 is convex over the interval where it is real-valued.

Asked:

on 10 May 2016

Commented:

on 11 May 2016

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!