Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Answer in matlab code. Please leave comments to be able to understand what is your thinking as you do the problem. Specify which is the
Answer in matlab code. Please leave comments to be able to understand what is your thinking as you do the problem. Specify which is the scrip and functions. Make sure it runs and show some of the results not all.
Consider the following two roots problems: f(x)sin(2.5x) -tan(x /3)- For this problem you will find the first positive root of each function using two different methods as follows. Use Newton-Raphson (newton raphs on .m ) with a stopping criterion of ,-1E-5 and initial guesses of 1.0 for fand 0.4 for g. Save the final value of &a associated with the root of each function and store therm in a two-element row vector ([60, g ). Also save the iteration counts for each function and store them in a two-element row vector. . Write a function m-file that implements the secant method. Your function should accept the function and two initial guesses as input arguments. For the stopping criterion and a maximum iteration count you can use input arguments with defaults as is done in bisect_param.m and newtonraphson.m. Use a stopping criterion of & 1E-5 and initial guesses of [1.0, 1.2] for fand [0.4,0.6] for g. Save the final value of &, associated with the root of each function and store them in a two-element row vector Ea ). Also save the iteration counts for each function and store them in a two-element row vector. ANSWERS: Write your Newton-Raphson results for the roots of ft) and g(x) to A6.dat and A7.dat respectively. Write your &results and iteration counts for Newton-Raphson to A8.dat and A9.dat respectively (both 1x2). Write your Secant Method results for the roots of fox) and gfx) to A10.dat and All.dat. Write your s results and iteration counts for the Secant Method to A12.dat and A13.dat (both 1x2) Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started