Question: Solve the equation using Newton Raphson method: x^3-5x^2+3x=1. a) Solve it in excel. The starting point is x=8. Only do 5 iterations. b) Write a

Solve the equation using Newton Raphson method: x^3-5x^2+3x=1.

a) Solve it in excel. The starting point is x=8. Only do 5 iterations.

b) Write a MATLAB code to solve this equation. Find the derivation manually and then put it in the code(code does not need to do derivation). The starting point is x=8. Use a while loop that stops when the x of solution can reduce he absolute value of equation to 0.001 or smaller. Your code should report the number of iteration and the value of solution, x.

MATLAB CODE:

x = 8; %starting point x_old = 100; %intitialized val = 1; %value of the function at new root intitialized to 1 iter = 0;

while val > 10^-3 || val < -10^-3 %|val|<0.001 x_old = x; x = x - (x^3 - 5*x^2 + 3*x -1)/(3*x^2 - 10*x +3); val = (x^3 - 5*x^2 + 3*x -1); iter = iter + 1; end

fprintf('Iteration %d: x=%.20f, value=%.20f ', iter, x, val);

c)Use the code you wrote in part b, and this time use x=3 as the starting point. What is the answer? What do you think happen that you cannot come up with a solution with x=3, but you can with x=8?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!