How to run an Optimization function in Matlab? Minimize function
古いコメントを表示
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 件)
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
2016 年 9 月 23 日
Matt J
2016 年 9 月 23 日
Amine,
As I said, the appropriate solver for linear B is just mldivide, i.e.,
X=Q\C
カテゴリ
ヘルプ センター および File Exchange で Nonlinear Optimization についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!