Error using fzero (line 306) FZERO cannot continue because user-supplied function_handle ==> @(x)((x(i)​/gemmai(i)​)*(exp(D(i​)/x(i))-1)​+x(i)-C(i)​) failed with the error below. Index exceeds array bounds. Error in abc (line 6) y=fzero(fun,12);

i am trying to solve this very simple code but facing the above error. can any body please help me?
gemmai=[2.188410605019781 0.024184639877264 3.377571120311852 0.010142425294078];
D=[1 1 1 1];
C=[1.033272967809139 0.390745943499492 0.078198616964645];
for i=3:-1:1
fun=@(x)((x(i)/gemmai(i))*(exp(D(i)/x(i))-1)+x(i)-C(i));
y=fzero(fun,12);
end

 採用された回答

Torsten
Torsten 2018 年 6 月 20 日
fun=@(x)((x/gemmai(i))*(exp(D(i)/x)-1)+x-C(i));

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMathematics についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by