MATLAB Answers

I have a problem with (IterMeth )

8 views (last 30 days)
Saad Almalki
Saad Almalki on 7 Dec 2020
Commented: Image Analyst on 7 Dec 2020
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

Answers (0)

Tags

Products


Release

R2019b

Community Treasure Hunt

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

Start Hunting!