Question

6) Use MATLAB and Newton-Raphson method to find the roots of the function, f(x) = x-exp (0.5x) and define the function as well as its derivative like so, fa@(x)x^2-exp(.5%), f primea@(x) 2*x-.5*xexp(.5%) For each iteration, keep the x values and use 3 initial values between -10 & 10 to find more than one root. Plot each function for x with respect to the iteration #.

0 0
Add a comment Improve this question Transcribed image text
Answer #1
clear
x0=9;%this is the initial guess, change it accordingly
ini=x0;
f=@(x)x.^2-exp(.5*x);
f_prime=@(x)2*x-.5*x*exp(.5*x);
i=0;
while abs(f(x0))>.0000001%finding root upto 6 decimal points
    x0=x0-f(x0)/f_prime(x0);
    i=i+1;
    x(i)=x0;
end
fprintf('For initial guess:%.2f,Root found=%f\n',ini,x0);
figure
plot(1:i,f(x))
title(['Initial guess: ' num2str(ini)])

Command Window >>NewtonRaphson3v For initial guess:-2.00, Root found--0.815553 >>NewtonRaphson3v For initial guess:2.00, Root

Add a comment
Know the answer?
Add Answer to:
6) Use MATLAB and Newton-Raphson method to find the roots of the function, f(x) = x-exp...
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...

  • Use the following pseudocode for the Newton-Raphson method to write MATLAB code to approximate the cube...

    Use the following pseudocode for the Newton-Raphson method to write MATLAB code to approximate the cube root (a)1/3 of a given number a with accuracy roughly within 10-8 using x0 = a/2. Use at most 100 iterations. Explain steps by commenting on them. Use f(x) = x3 − a. Choose a = 2 + w, where w = 3 Algorithm : Newton-Raphson Iteration Input: f(x)=x3−a, x0 =a/2, tolerance 10-8, maximum number of iterations100 Output: an approximation (a)1/3 within 10-8 or...

  • 1. This question concerns finding the roots of the scalar non-linear function f(x) = r2-1-sinx (1...

    1. This question concerns finding the roots of the scalar non-linear function f(x) = r2-1-sinx (1 mark) (b) Apply two iterations of the bisection method to f(x) 0 to find the positive root. (3 marks) (c) Apply two iterations of the Newton-Raphson method to find the positive root. Choose (3 marks) (d) Use the Newton-Raphson method and Matlab to find the positive root to 15 significant (3 marks) (a) Use Matlab to obtain a graph of the function that shows...

  • Newton-Raphson scheme ? Calculus Suppose you want to find zeros of the function f(x)102212 and plan to use the Newton-Raphson scheme. (a) Write down the Newton-Raphson algorithm for this. That is, wri...

    Newton-Raphson scheme ? Calculus Suppose you want to find zeros of the function f(x)102212 and plan to use the Newton-Raphson scheme. (a) Write down the Newton-Raphson algorithm for this. That is, write down explicitly a formula for computing your (n+1)st guess Tn+1 given your nth guess rn for a root. In other words, deter- mine the recurrence relation resulting from using this particular function f. (b) Modifying Algorithm 2.2 as required, find the values through x7 if you choose an...

  • Consider the following function with a real variable, x: ?(?) = ?3 - 3?2 + 6?...

    Consider the following function with a real variable, x: ?(?) = ?3 - 3?2 + 6? + 10 a. Write a Python function for the derivative of f(x) that takes x and returns the derivative of f(x). Take the derivative of f(x) analytically with respect to x before writing the function. b. Write a Python code that approximately finds the real root, x0, of f(x) such that f(x0)~0 using the Newton-Raphson method. The code is expected to get an initial...

  • (Numerical analysis) Here's a challenging problem for those who know a little calculus. The Newton-Raphson method...

    (Numerical analysis) Here's a challenging problem for those who know a little calculus. The Newton-Raphson method can be used to find the roots of any equation0.n this method the (i + Dst approximation, xi-1, to a root ofy(x) = 0 İs given in terms of the ith approximation, xi by the following formula, where y' denotes the derivative of y(x) with respect tox: For example, if yx) 32+2x - 2, then y()-2, and the roots are found by making a...

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

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

  • Let the mathematical function flu) be defined as: f(x)-exp-0.5x)cos(5x) - 0.5 .x>0 Write a Matlab...

    Please follow the instructions without using other solutions. Thank you in advance Let the mathematical function flu) be defined as: f(x)-exp-0.5x)cos(5x) - 0.5 .x>0 Write a Matlab function called Newton1 that would find the zero based on a passing initial guess as an input argument x0. The function returns the estimated zero location x, the function value at the zero location (f) and the number of iteration k. The iteration function converges if f(%) < 5"eps and it should diverge...

  • Please MATLAB for all coding with good commenting. (20) Consider the function f(x) = e* -...

    Please MATLAB for all coding with good commenting. (20) Consider the function f(x) = e* - 3x. Using only and exactly the four points on the graph off with x-coordinates -1,0, 1 and 2, use MATLAB's polyfit function to determine a 3' degree polynomial that approximates f on the interval (-1, 2]. Plot the function f(x) and the 360 degree polynomial you have determined on the same set of axes. f must be blue and have a dashed line style,...

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
Active Questions
ADVERTISEMENT