Question

45-3. Modify the code used in Example 4 to find the root only at f(x)<0.01 using Newton-Rephson Method without showing any it
العقدة College of 9:05 mybb.qu.edu.ca Numerical Methods (Lab.) GENG 300 Summer 2020 5.1.2 Open Methods - Newton-Raphson Metho
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Vo)) LTE 46 19% 12:00 MATLAB Drive nu.m n = 2 f = @(x) x^5 -3*x-10; 3 fd = @(x) 5*x^4-3; 4 po = input(Enter initial approximVo)) 4G LTE ml 19% 0 12:00 >> nu Enter initial approximaation: 2 Enter no. of iterations, n: 100 Enter tolerance, tol: 0.0001matlab code:

f = @(x) x^5-3*x-10;
fd = @(x) 5*x^4-3;
p0 = input('Enter initial approximaation: ');
n = input('Enter no. of iterations, n: ');
tol = input('Enter tolerance, tol: ');
i = 1;
while i <= n
    d=f(p0)/fd(p0);
    p0 = p0 - d;
    if abs(d) < tol
       fprintf('\nApproximate solution x= %11.8f \n\n',p0);


       break;
    else
       i = i+1;
    end
end

Add a comment
Know the answer?
Add Answer to:
45-3. Modify the code used in Example 4 to find the root only at f(x)<0.01 using...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 5.1.2 Open Methods - Newton-Raphson Method Xi+1= xi – FOTO Matlab Code Example:4 function mynewtraph (f,...

    5.1.2 Open Methods - Newton-Raphson Method Xi+1= xi – FOTO Matlab Code Example:4 function mynewtraph (f, f1,x0,n) Xx0; for ilin x = x - f(x)/f1(x); disp (li if f(x) <0.01 f(x))) break end end end Matlab Code from Chapra function [root, ea, iter)=newtraph (func,dfunc, xr, es,maxit,varargin) newtraph: Newton-Raphson root location zeroes 8 [root, ea, iter)-newtraph (func, dfunc, xr, es,maxit,pl,p2, ...): $uses Newton-Raphson method to find the root of fune input: func- name of function 8dfunc = name of derivative of...

  • . (25 points) The recurrence relation for the Newton's Raphson method is a)0.1.2 f(r.) F(z.) The ...

    . (25 points) The recurrence relation for the Newton's Raphson method is a)0.1.2 f(r.) F(z.) The derivative of the function can be approximately evaluated using finite-difference method. Consider the Forward and Centered finite-difference formulas Forward Finite-Difference Centered Finite-Difference 2h It is worthwhile to mention that modified secant method was derived based on the forward finite- difference formula. Develop a MATLAB functions that has the following syntax function [root,fx,ea,iter]-modnetraph (func,x0,h,es,maxit,sethod, varargin) % modnevtraph: root location zeroes of nonlinear equation f (x)...

  • ____________ % This function is a modified versio of the newtmult function obtained % from % “Ap...

    ____________ % This function is a modified versio of the newtmult function obtained % from % “Applied Numerical Methods with MATLAB, Chapra, % 3rd edition, 2012, McGraw-Hill.” function [x,f,ea,iter]=newtmult(func,x0,es,maxit,varargin) % newtmult: Newton-Raphson root zeroes nonlinear systems % [x,f,ea,iter]=newtmult(f,J,x0,es,maxit,p1,p2,...): % uses the Newton-Raphson method to find the roots of % a system of nonlinear equations % input: % f = the passed function % J = the passed jacobian % x0 = initial guess % es = desired percent relative error...

  • Write a MATLAB function newtonRaphson(fx, x0, sigfig, maxIT) that will return a root of the funct...

    Write a MATLAB function newtonRaphson(fx, x0, sigfig, maxIT) that will return a root of the function f(x) near x=x0 using the Newton-Raphson method, where sigfig is the accuracy of the solution in terms of significant figures, and maxIT is the maximum number of iterations allowed. In addition to the root (xr), the function newtonRaphson is expected to return the number of iterations and an error code (errorCode). As such, the first line of the function m file newtonRaphson.m must read...

  • Problem 12.12 Pls show the m-file Develop your own M-file function for the Gauss-Seidel method without...

    Problem 12.12 Pls show the m-file Develop your own M-file function for the Gauss-Seidel method without relaxation based on Fig. 12.2, but change the first line so that it returns the approximate error and the number of iterations: function [x, ea, iter] = ... GaussSeidel (, b, es, maxit) Test it by duplicating Example 12.1 and then use it to solve Prob. 12.2a. Develop your own M-file function for Gauss-Seidel with relaxation. Here is the function's first line: function [x,...

  • You are given the following function y = x^4 - 12x^3 + 49x^2 - 78x +...

    You are given the following function y = x^4 - 12x^3 + 49x^2 - 78x + 40 Plot this function and use graphic methods to initially estimate the roots of this function. Develop an M-file for false-position method based on figure 5.15 in our textbook. Estimate the third root using your program, until epsilon_a is smaller than 0.5% Fill up the following table for one of the roots FIGURE 5.15 Pseudocode for the modified false-position method. FUNCTION ModFalsePos(xl, xu, es,...

  • lowest positive root of f(x)= 8sin(e-x)-1

    Determine the lowest positive root of f (x) = 8sin(x)e–x – 1:(a) Graphically.(b) Using the Newton-Raphson method (three iterations, xi = 0.3).(c) Using the secant method (three iterations, xi–1 = 0.5 and xi = 0.4.(d) Using the modified secant method (five iterations, xi = 0.3, δ = 0.01).

  • L. Determine the real root(s) off(x)--5xs + 14x3 + 20x2 + 10x a. Graphically on a graph paper. b....

    l. Determine the real root(s) off(x)--5xs + 14x3 + 20x2 + 10x a. Graphically on a graph paper. b. Using Bisection method c. Using False Position method to determine the root, employing initial guesses of x-2 d. Using the Newton Raphson methods to determine the root, employing initial guess to determine the root, employing initial guesses ofxn-2 and Xu-4 and Es= 18%. and r 5.0 andas answer. 1%. was this method the best for these initial guesses? Explain your xo--l...

  • Xs 2x2 Use the MAT AB code for Newton-Raphson method to find a root of he function table. x 6x 4 ...

    xs 2x2 Use the MAT AB code for Newton-Raphson method to find a root of he function table. x 6x 4 0 with he nitial gues& xo 3.0. Perfonn the computations until relative error is less than 2%. You are required to fill the followi Iteration! 뵈 | f(x) | f(x) | Em(%) 1. Continue the computation of the previous question until percentage approximate relative error is less 2. Repeat computation uing theial guess o1.0 xs 2x2 Use the MAT...

  • Use the Newton-Raphson method to find the root of f(x) = e-*(6 - 2x) - 1...

    Use the Newton-Raphson method to find the root of f(x) = e-*(6 - 2x) - 1 Use an initial guess of xo = 1.2 and perform 3 iterations. For the N-R method: Xi+1 = x; - f(x;) f'(x;)

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT