Newtons Method (Receiving multiple errors)
13 ビュー (過去 30 日間)
古いコメントを表示
function root = newtons(fun,dfun,x0)
format long
x = fzero(fun,x0);
xi = x0;
count = 0;
fprintf('The MATLAB approximation of the real zero of the function is %s\n',x)
while abs(xi - x) > 10^(-12)
xj = xi - ((fun(xi))/(dfun(xi)));
xi = xj;
count = count + 1;
end
fprintf('Number of iterations: %s \n',count)
root = xi;
end
I am trying to perform the newtons method and have been receiving this error in my code when i try to run "root = newtons(fun,dfun,0.5)" in my livescript. I could really use some help as this is beginning to drive me crazy and im not sure what is wrong with my code. My project is asking for the amount of iterations and the original approximation.

0 件のコメント
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Software Development Tools についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!