[Solved]Write Function Header Function R Mynewtonraphson F Fp X0 Tol Takes Inputs F Function Handl Q37243916
Write a function with the header: function [R] =myNewtonRaphson(f, fp, x0, tol) which takes as inputs f: afunction handle fp: a function handle to the derivative of f (notehow it appears in the test case) ME 202 Computer ProgrammingApplications for Mechanical Engineers x0: the initial guess of theroot tol: a tolerance above which the algorithm will keep iteratingTips: Be sure to include an iteration counter which will stop thewhile-loop if the number of iterations get greater than 1000. Itis not necessary to print out a convergence table within the whileloop. (I.e., there should be no fprintf statements in your code)Test Case: >> format long >> f = @(x)2*(1-cos(x))+4*(1-sqrt(1-(0.5*sin(x)).^2)) – 1.2; >> df =@(x) (f(x + 1e-8) – f(x)) / 1e-8; >> root =myNewtonRaphson(f, df ,1, 1e-8) root = 0.958192178746275
![3. Write a function with the header function [R] = myNewtonRaphson(f, fp, x0, tol) which takes as inputs f: a function handle](https://media.cheggcdn.com/media%2Fc88%2Fc88daeb4-0fec-47f8-b21e-01748e3c9d18%2FphpIofGiX.png)
IT HAS TO BE function [R] , CANT BEfunction [R, i] or function [R, count] etc. Thank you inadvance
3. Write a function with the header function [R] = myNewtonRaphson(f, fp, x0, tol) which takes as inputs f: a function handle Ep: a function handle to the derivative of f (note how it appears in the test case) ME 202 Computer Programming Applications for Mechanical Engineers x0: the initial guess of the root tol: a tolerance above which the algorithm will keep iterating Tips: .Be sure to include an iteration counter which will stop the while-loop if the number of iterations get greater than 1000. . It is not necessary to print out a convergence table within the while loop. (Le, there should be no fprintf statements in your code) TestCase >format long (x) 2* (1-cos (x))+4 (1-sqrt (1-(0.5 sin(x)).2))1.2 >> df = @(x) (f (x + le-8) -f(x)) / le-8; >> rootmyNewtonRaphson(f, df ,, le-8) root 0.958192178746275 Show transcribed image text 3. Write a function with the header function [R] = myNewtonRaphson(f, fp, x0, tol) which takes as inputs f: a function handle Ep: a function handle to the derivative of f (note how it appears in the test case) ME 202 Computer Programming Applications for Mechanical Engineers x0: the initial guess of the root tol: a tolerance above which the algorithm will keep iterating Tips: .Be sure to include an iteration counter which will stop the while-loop if the number of iterations get greater than 1000. . It is not necessary to print out a convergence table within the while loop. (Le, there should be no fprintf statements in your code) TestCase >format long (x) 2* (1-cos (x))+4 (1-sqrt (1-(0.5 sin(x)).2))1.2 >> df = @(x) (f (x + le-8) -f(x)) / le-8; >> rootmyNewtonRaphson(f, df ,, le-8) root 0.958192178746275
Expert Answer
Answer to Write a function with the header: function [R] = myNewtonRaphson(f, fp, x0, tol) which takes as inputs f: a function han… . . .
OR

