fzero for sum of functions?

4 ビュー (過去 30 日間)
JK
JK 2015 年 9 月 9 日
回答済み: Walter Roberson 2015 年 9 月 9 日
The actual equation is 0 = sum(ai/(ai-p)) where i is 1 to 4 and I have to look for p values.
This is what I put in the code,
a=[1.2 3.5 1.9 1];
func=@(p)sum((a/(a-p)))
fsolve(func,0)
and the answer it is giving me is -154.25. I checked with my calculator and it does not make sense. Is there something wrong with this code possibly? I am little bit confused about putting function inside the sum().

回答 (1 件)

Walter Roberson
Walter Roberson 2015 年 9 月 9 日
func=@(p)sum((a./(a-p)))

カテゴリ

Help Center および File ExchangeOptimization についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by