Solved by Expert Tutors
Provide a function rfNewtonR that implements the Newton-Raphson metnod.
Solved by Expert Tutors
Question

# Provide a function rfNewtonR that implements the Newton-Raphson metnod.

Codes should include fun(x), x0 = initial guess for the root, TolX = desired relative error for the root given by |x_i+1 - x_i| / |x_i|, itmax = maximum number of iteratinos. I don't know what I did wrong but I always get the wrong x value.

function x = rfNewtonR(fun,x,TolX,itmax)
[f, fp] = fun(x);
% Find the root of f(x) = 0 using the Newton-Raphson method.
x0 = 0;
iter = 0;
TolX = 1e-6;
itmax = 20;
while (iter&lt;itmax) &amp;&amp; (abs(fun(x))&gt;TolX)
x = x0-(f(x0)/fp(x0));
iter = iter +1;

end
% Start the iteration.
if iter == itmax
msgID = 'rfNewtonR: IterationLimitExceeded'
error(msgID)
else
disp(x)

end
end

gue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum doloracinia pulvifficitur laoreetnece vel laoreet ac, dt0sum0ng elit.0ce dui lecfoicitur laoFonec aliqutec aliquet. Lorem ipsum dolor sit amet, cot0s a molestie consequat, ultrices ac magntrisus ante, dapibtdictum vitae odio. Dta. Fusce dui lectu0facilisis. Pelleniscinitur laoreet. Namces a mtec aliquet. Ltsumtconsectiscing etcongue vel laoreet ac, dictum vitcaciniasmolestie consequat, ultricese vel laoreet amipsuce dui lecrem ipsumfacilisis.tnec facil

### Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

• ### -

Study Documents

Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

Browse Documents