Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Write a function with the prototype function r secant (f, x0, x1, tol, kmax) which implements the secant method to find a root

 

1. Write a function with the prototype function r secant (f, x0, x1, tol, kmax) which implements the secant method to find a root of a function f between x0 and x1. Successive estimates are calculated until either the relative error ek is less than tol or k=kmax. Recall that ek Ik-k-1 Ik Test that your function is working correctly by choosing a simple test function where you know the location of one (or more) of its roots. 2. Write a script that uses your function from question 1 to find the roots of 1 f(x)=+xsin ( with tol 10 and kmax = 20. Plot the graph of f(x). The plot will help you = choose appropriate values of x0 and x1 to find all of the roots of f(x). 3. Check your answers to the previous question using MATLAB's built-in fzero function. 4. Add the roots of f(x) to your plot of f(x), ensuring that they are clearly marked.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Calculus

Authors: Dale Varberg, Edwin J. Purcell, Steven E. Rigdon

9th edition

131429248, 978-0131429246

More Books

Students also viewed these Computer Network questions

Question

explain why both internal and external recovery are important;

Answered: 1 week ago

Question

explain an efficient market and it's implications.

Answered: 1 week ago

Question

Solve each equation. x 3 - 6x 2 = -8x

Answered: 1 week ago