How to find the minimum of a three variable function (optimization)?

41 ビュー (過去 30 日間)
Marina Pirzada
Marina Pirzada 2020 年 4 月 13 日
コメント済み: Torsten 2023 年 4 月 9 日
Hi, I am trying to write a code that finds the minimum of f(x,y,z)=(x^2 + 2y^2 + 3z^2) ^2
To find the critical points we want to find where the gradient is equal to 0 correct? I am having trouble putting this into code. Does anyone know where I can find resources to write a code for this?
  2 件のコメント
Walter Roberson
Walter Roberson 2020 年 4 月 14 日
By inspection: What is the smallest value each of the components could be, considered independently of each other? Ignoring cross-terms for the moment that could force the overall expression to be greater, what is the smallest that each term could be? What is the sum of those possibilities? That gives you a first approximation of the minima. Now look again at the cross-terms: is it possible for each of those terms to achieve their minima simultaneously? If so what is the overall minima?
Walter Roberson
Walter Roberson 2020 年 4 月 14 日
If only there were a SYMbolic toolbox that you could ask to SOLVE the GRADIENT.

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

回答 (1 件)

Guru Mohanty
Guru Mohanty 2020 年 4 月 16 日
To find Minimum of a three variable function you follow these two processes.
  1. Using Symbolic Toolbox
  • Define your variables using syms & Construct the function.
  • Find derivative by diff function and make it Zero.
  • By solving the equation using solve function, you can get minima.
2. Using fminsearch
  • Create a function handle for the expression.
  • Use fminsearch to find minimum.
f=@(x,y,z)(x.^2 + 2*y.^2 + 3*z.^2).^2;
[fmin,minVal] = fminsearch(@(b) f(b(1),b(2),b(3)), [1; 1 ; 1]);
  3 件のコメント
Walter Roberson
Walter Roberson 2023 年 4 月 9 日
The above techniques cannot (easily) handle bounded problems. For bounded problems you would typically use fmincon

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

カテゴリ

Help Center および File ExchangeSolver Outputs and Iterative Display についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by