How to run an Optimization function in Matlab? Minimize function

조회 수: 1 (최근 30일)
Amine Ben Ayara
Amine Ben Ayara 2016년 9월 21일
댓글: Matt J 2016년 9월 23일
Hello, So I have a simple optimization problem that consist of finding a value for a variable that minimizes the difference between two other variables. For example, First input element; An Arbitrary value of X=10. Q=100; B=X*Q; C=50; The objective is to find the value of X that minimizes the difference between (X*Q) & C; f(X)=(X*Q)-C; Is there a function that will give this output or do I need to run a loop that keeps solving for X until it finds a value that minimizes the function f(X)? Thank you so much Matlab pros!

답변 (1개)

Matt J
Matt J 2016년 9월 21일
편집: Matt J 2016년 9월 21일
X=Q\C ?
If B is a non-linear function of X, maybe you are looking for fzero, fsolve, or lsqcurvefit.
  댓글 수: 2
Amine Ben Ayara
Amine Ben Ayara 2016년 9월 23일
Hello Matt, B is a linear function; B is simply the product of X & Q. I saw several methods in matlab help site to solve an optimization problem but I did not quite understand.
Matt J
Matt J 2016년 9월 23일
Amine,
As I said, the appropriate solver for linear B is just mldivide, i.e.,
X=Q\C

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

카테고리

Help CenterFile Exchange에서 Nonlinear Optimization에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by