I have a problem with (IterMeth )

9 ビュー (過去 30 日間)
Saad Almalki
Saad Almalki 2020 年 12 月 7 日
回答済み: ahmed mahmood 2021 年 10 月 9 日
function [ val, ea, iter] = IterMeth(x , es, maxit)
%initialization
iter=1;
val = 1;
sol = val;
ea =100;
%iterative calculation
while (1)
solold=sol;
sol = s0l+x^iter/factorial(iter);
iter= iter+ 1;
if sol~=0
ea=abs((sol-solold)/sol)*100;
end
if ea<=es || iter >= maxit,break,end
end
val=sol;
end

回答 (2 件)

ahmed mahmood
ahmed mahmood 2021 年 10 月 9 日
Terms Result εt , % εa, % 1 1 39.3 2
1.5 9.02 33.3 3
1.625 1.44 7.69 4
1.645833333 0.175 1.27 5
1.648437500 0.0172 0.158 6
1.648697917 0.00142 0.0158

ahmed mahmood
ahmed mahmood 2021 年 10 月 9 日
Terms Result εt , % εa, % 1 1 39.3 2
1.5 9.02 33.3 3
1.625 1.44 7.69 4
1.645833333 0.175 1.27 5
1.648437500 0.0172 0.158 6
1.648697917 0.00142 0.0158

カテゴリ

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

タグ

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by