Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Code in MATLAB! I need everything please! Step by step and it's ok if graphs aren't included. Need it ASAP. Thank you! For this chapter,
Code in MATLAB! I need everything please! Step by step and it's ok if graphs aren't included. Need it ASAP. Thank you!
For this chapter, you will write adaptable scripts for the bisection method, fixed-point method, Newton's method, and the secant method and do some tests to evaluate their performance. Begin by writing a function named my_fun, which returns f(x) for a given input x and one named my_fun_deriv, which returns the derivative of f(x) at x. Then write functions called Bisection, Fixed_Point, Newton and Secant, which call these functions to compute the zeros of f and output the sequence of pn s used by the method. Consider the equations: f1(x)=21sin((x1)2) and f2(x)=5x2. Plot each of these functions to get an idea of where the smallest positive fixed points lie. Then, for each method listed above, compute the first 15 iterations of each root-finding algorithm and create a table of the absolute errors. You must determine appropriate starting points and report them. Then plot these errors for each method on a single graph with the x-axis as iterations and the y-axis as the error for each f. Repeat this for a log-log plot. You may need to adjust the scales and/or use multiple plots on different scales to illustrate the results properly. Attach the code for my_fun, my_fun_deriv, Bisection, Fixed_Point, Newton and Secant at the end of your report 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