How can I find maximum of a function in MATLAB?

How can I find the maximum value of a function in MATLAB? And that function has some subject to constrain criteria also.

 採用された回答

Titus Edelhofer
Titus Edelhofer 2015 年 5 月 5 日

0 投票

Hi Gollapinni,
usually by finding the minimum of "-f". How to do this depends on your function. Good starting point is fminsearch, or, if you have constraints, fmincon from Optimization Toolbox.
Titus

4 件のコメント

Gollapinni Karthik
Gollapinni Karthik 2015 年 5 月 6 日
Hi Titus,
So I multiply my function with - to find the minimum? Because solvers in the Optimization Toolbox are aiming for minimization but I am looking for maximization. So how can I do this? Any tips?
Karthik
Alan Weiss
Alan Weiss 2015 年 5 月 6 日
This question is addressed in the documentation. In more than one place.
Alan Weiss
MATLAB mathematical toolbox documentation
Gollapinni Karthik
Gollapinni Karthik 2015 年 5 月 6 日
Thanks a lot. It really helpful. Karthik
Gollapinni Karthik
Gollapinni Karthik 2015 年 5 月 7 日
How do I set these kinds of Subject to k, m ϵ N s ϵ [0, 1] my maximum function? How to model it belong to Natural number in Matlab and belongs to only 0 and 1 in Matlab?

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by