Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a user-defined function with function call [r k] = root_finder(f,x0,kmax,tol) where f is an inline function, x0 is a specified value, kmax is the

Write a user-defined function with function call [r k] = root_finder(f,x0,kmax,tol) where f is an inline function, x0 is a specified value, kmax is the maximum number of iterations, and tol is a specified tolerance. The function sets x1 = x0, calculates |f(x1)|, and if it is less than the tolerance, then x1 approximates the root r. If not, it will increment x1 by 0.01 to obtain x2, repeat the procedure, and so on. The process terminates as soon as |f(xk)| < tol for some k. The outputs of the function are the approximate root and the number of iterations it took to find it. Execute the function for f(x) = x2 3.3x + 2.1, x0 = 0.5, kmax = 50, tol = 10-2. Repeat problem for f(x)=3+ln(2x-1)-ex ,x0=1, kmax=25, tol = 10-2 (using Matlab)

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

Practical Issues In Database Management A Refernce For The Thinking Practitioner

Authors: Fabian Pascal

1st Edition

0201485559, 978-0201485554

More Books

Students also viewed these Databases questions

Question

What else should have been included?

Answered: 1 week ago