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<itmax) && (abs(fun(x))>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

Step-by-step answer

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

Subscribe to view the full answer

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
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question
Let our 24/7 matlab tutors help you get unstuck! Ask your first question.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes