Answered step by step
Verified Expert Solution
Question
1 Approved Answer
MATLAB CODE Consider the following function, f(x)=tan1(x)cos(x)+1. Please answer the following: (a) In a separate m-file, write a function called atanCosi, which aocepts x as
MATLAB CODE
Consider the following function, f(x)=tan1(x)cos(x)+1. Please answer the following: (a) In a separate m-file, write a function called atanCosi, which aocepts x as an input, and outputs f(x). Include a published version of this function (pdf format) as part of your Canvas submission. (b) In a separate m-file, write a function called d_atanCos1, which outputs the first derivative 2, f(x). Include a published version of this function (pdf format) as part of your Canvas submission. (c) In a single plot, superimpose f(x) and f(x) in the range 0x. You should be able to identify a single root of f(x) in this interval. 2 You should find the derivative by pen and paper, then code it up in MATLAB. Don't try to make MATLAB take the derivative for you. (d) Calculate the root using the biscction method with initial brackets [2,3] and a tolerance of 1015. Store the value of the calculated root and the number of iterations required in variables called xRoot_BS and nIters_BS, respectively. (e) Plot the root calculated in part (d) as a single marker in the figure generated by part (c). Add a legend 3 to identify the function, its derivative, and the root.. (f) Repeat part (d) using the secant method. Use the initial brackets from part (d) as the starting points for the secant method, and the same tolerance. Store the value of the calculated root and the number of iterations required in variables called xRoot_SM and nIters_SM, respectively. (g) Repeat part (d) using the Newton-Raphson method. Use the initial guess x0=2 and the same tolerance as parts (d) and (f). Store the value of the calculated root and the number of iterations required in variables called xRoot_NR and nIters_NR, respectivelyStep 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