multi-variable optimization in matlab?

조회 수: 5 (최근 30일)
Abdelrahman Taha
Abdelrahman Taha 2019년 12월 6일
댓글: Abdelrahman Taha 2019년 12월 7일
Hi,
I need to minimize a function that involves two variables. The problem is that this function is not directly related to those two variables, which means i can't use the standard optimization functions like fminsearch. Many other variables are to be calculated first, which are actually functions of the first two variables, and then they're used to calculate the function. And I can't put the function and the two variables in one equation. So, what options do I have in matlab to solve this optimization problem?
Thanks

채택된 답변

Matt J
Matt J 2019년 12월 6일
편집: Matt J 2019년 12월 6일
Many other variables are to be calculated first, which are actually functions of the first two variables, and then they're used to calculate the function....And I can't put the function and the two variables in one equation.
None of the above are requirements of fminsearch or any other Matlab optimization routine. Go ahead and create a function with as many lines as you need. Pass this function to fminsearch, fminunc, or whatever...
  댓글 수: 4
Matt J
Matt J 2019년 12월 7일
편집: Matt J 2019년 12월 7일
You're welcome. One final footnote, though. fminunc and fmincon assume that your objective function is differentiable. This does not mean it must be expressed in a single of code, but it means you must be sure, on analytical grounds, that the code represents a differentiable operation. fminsearch does not require this.
Abdelrahman Taha
Abdelrahman Taha 2019년 12월 7일
Thanks for highlighting that. They're all linear equations, so both fmincon and fminsearch will be ok.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with Optimization Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by