Restricting domain of values fzero will try

56 ビュー (過去 30 日間)
Alexander Holmes
Alexander Holmes 2018 年 10 月 30 日
コメント済み: Alexander Holmes 2018 年 10 月 30 日
I am using fzero along with an implementation of the gillespie algorithm to determine a parameter (I know the vale of a parameter at steady state, but now I want it proportional to another quantity, and I am using fzero to determine this constant of proportionality, alpha).
However, the simulation only works if alpha is positive, otherwise we get negative rates which mess everything up. From what I can tell, fzero is trying negative values of alpha when trying to find the zero. Is there any way I can restrict fzero to only use positive values?

採用された回答

Matt J
Matt J 2018 年 10 月 30 日
編集済み: Matt J 2018 年 10 月 30 日
Specify the search interval [xlower, xupper] to include only non-negative values.
fzero(fun,[xlower, xupper])
  3 件のコメント
Matt J
Matt J 2018 年 10 月 30 日
You could make a change of variables in your function like s^2=alpha. An unconstrained search over s is equivalent to a search of non-negative alpha.
Alexander Holmes
Alexander Holmes 2018 年 10 月 30 日
Thank you!

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

その他の回答 (1 件)

Matt J
Matt J 2018 年 10 月 30 日
You could make a change of variables in your function like s^2=alpha. An unconstrained search over s is equivalent to a search of non-negative alpha.

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by