Question

B. Implement the Newton-Raphson (NR) method for solving nonlinear equations in one dimension. The program should be started f

0 0
Add a comment Improve this question Transcribed image text
Answer #1

`Hey,

Note: Brother in case of any queries, just comment in box I would be very happy to assist all your queries

clc
clear all
close all

f = @(x) 8000*x-500*x^3+4000;
err=[];
R=[];
g=@(x) 8000-1500*x^2;
x0=input('Enter initial guess: ');
e=1e-7;
maxit=1000;
x1=x0;
x0=0;
N=0;
err=[];
while 1

if abs(f(x1))>e
x0=x1;
x1=x0-(f(x0)/g(x0));
N=N+1;
R(N)=x1;
err(N)=abs(f(x1));

else

break;

end
if(N==maxit)
break;
end

end
root=x1;
iter=N;
disp('So, final approximation is')
(root)
plot(err);
title('Plot of absolute error')
figure;
plot(R);
title('Plot of root')
figure;
fplot(f,[-2+x1,x1+2]);
hold on;
plot(x1,f(x1),'*r');
title('Plot to verify root');

MATLAB R2018a EDITOR Figure Search Documentation Log In File Edit View Insert Tools Desktop Window Help Figure File Edit View

Kindly revert for any queries

Thanks.

Add a comment
Know the answer?
Add Answer to:
B. Implement the Newton-Raphson (NR) method for solving nonlinear equations in one dimension. The...
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
  • A. Implement the False-Position (FP) method for solving nonlinear equations in one dimension. The...

    A. Implement the False-Position (FP) method for solving nonlinear equations in one dimension. The program should be started from a script M-file. -Prompt the user to enter lower and upper guesses for the root. .Use an error tolerance of 107. Allow at most 1000 iterations The code should be fully commented and clear " 1. Use your FP and NR codes and appropriate initial guesses to find the root of the following equation between 0 and 5. Plot the root...

  • 6.5 Employ the Newton-Raphson method to determine a real root for 4x20.5 using initial guesses of...

    6.5 Employ the Newton-Raphson method to determine a real root for 4x20.5 using initial guesses of (a) 4.52 f(x) 15.5x Pick the best numerical technique, justify your choice and then use that technique to determine the root. Note that it is known that for positive initial guesses, all techniques except fixed-point iteration will eventually converge. Perform iterations until the approximate relative error falls below 2 %. If you use a bracket- ing method, use initial guesses of x 0 and...

  • (la) Determine the root of the x – ez* + 5 = 0 using the Newton-Raphson...

    (la) Determine the root of the x – ez* + 5 = 0 using the Newton-Raphson method with equation initial guess of xo = 1. Perform the computation until the percentage error is less than 0.03%. (1b) Employ bisection method to determine the root of the f(x)=x* – 3x + 7 =0) using equation two initial guesses of x; =-2.1 and x;, =-1.8 . Perform three iterations and calculate the approximate relative error for the third iteration. What is the...

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

  • Problem Two: (Based on Chapra, Problems 12.9 Consider the simultaneous nonlinear equations: 2-5-y y+i- 1. Plot...

    Problem Two: (Based on Chapra, Problems 12.9 Consider the simultaneous nonlinear equations: 2-5-y y+i- 1. Plot the equations and identify the solution graphically. Page 1 of 2 2. Solve the system of equations using successive substitution, starting with the initial guess xo-y-1.5. Show two complete iterations. Evaluate &s for the second iteration. 3. Redo Part 2 using Newton-Raphson method . Automate the solutions in Parts 2 and 3 using MATLAB scripts 5. Solve the system of nonlinear equations by calling...

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

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

  • Newton invented the Newton-Raphson method for solving an equation. We are going to ask you to...

    Newton invented the Newton-Raphson method for solving an equation. We are going to ask you to write some code to solve equations. To solve an equation of the form x2-3x + 2-0 we start from an initial guess at the solution: say x,-4.5 Each time we have the i'h guess x, we update it as For our equation,f(x) = x2-3x + 2 andf,(x) = 2x-3. Thus, our update equation is x2 - 3x, 2 2x, - 3 We stop whenever...

  • Matlab problem using newton raphson to find square root of number

    Need help modifying my Matlab script below (myscript calculates the square root of a number. using a Newton-Raphson method with 1 as the initial guess, calculates true and estimated error, and shows each iteration).-I need to create three new functions each of which should be called in the main script. These functions are needed to replace code that is currently in my script shown below.-I need to create these functions:A function to find f(x)A function to find f '(x) ?A...

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