Root ?nding using the bisection method, MATLAB Programming

Assignment Help:

In many applications, including ?nancial mathematics, ?nding zeros of a function

f(x) = 0 (4)

is paramount. One of the simplest method is the Bisection Method. The bisection method is a systematic search technique for ?nding a zero of a continuous function. The method is based on a well-known property of continuous functions, the intermediate value theorem. We ?rst ?nd an interval in which a zero is known to occur. This is done by evaluating the function f(x) at a and b: if f(a) > 0 and f(b) < 0 or if f(a) < 0 and f(b) > 0 then there exists a number x = c, say, between a and b such that f(c) = 0.

Suppose that an interval [a, b] has been located which is known to contain a zero, since the function changes sign between a and b. The approximate solution is the midpoint of the interval and therefore the zero must now lie either in the interval [a, x1] or [x1, b]. The appropriate subinterval is determined by testing the function to see whether it changes sign on [a, x1].

If yes, the search continues to obtain the next point x2 = a+x1 Otherwise, the search continues on [x1, b to obtain x1 = x1+b And the search is repeated until one converges to the approximate root either given some tolerance or number of iterates to convergence.

Below, I give you a head start to writing a MATLAB function bisect to compute a zero of a function. Let us consider as inputs a, b, tolerance, nmax (we do not want our algorithm to run forever in case it can not ?nd a zero), and the function fun. You must ?nd was of declaring the function fun such that it can be read easily into our function bisect. We want to output xvect (the vector containing the approximates zeros x0, x1, · · · , etc.), xdif (this is the difference between the roots to monitor the error), fx (this is a vector with the values of the function evaluated at it approximate zero, i.e. a vector of all f(xi)) and ?nally nit (this is the maximum number of iterations taken to converge. If the  algorithm can not ?nd the zero, then nit = nmax).


Related Discussions:- Root ?nding using the bisection method

Gaussian elimination, Diary Files: Before doing this assignment, please rea...

Diary Files: Before doing this assignment, please read the document Notes on Matlab Assignments (available from the course web page). It describes how to record the results of your

CS 1371 HW, Function Name: voteCounter Inputs (1): - (char) filename of v...

Function Name: voteCounter Inputs (1): - (char) filename of votes Outputs (0): - none Function Description: You use the brand new VoteMaster 3000 to tally up votes in the r

Solve a programming problem, Write a function rid_multiple_blanks that will...

Write a function rid_multiple_blanks that will receive a string as an input argument. The string contains a sentence that may have multiple blank spaces in between some of the word

Printing - matrices, Printing - matrices: For matrices, the MATLAB unw...

Printing - matrices: For matrices, the MATLAB unwinds the matrix column by column. For illustration, consider the random 2 × 3 matrix as shown below: >> mat = randint(2,3,[

Statistics, Create a custom chi-square function in matlab, MATLAB in Statis...

Create a custom chi-square function in matlab, MATLAB in Statisticsn..

Calling an user-defined function from script, Calling an User-Defined Funct...

Calling an User-Defined Function from Script: Now, we will change our script which prompts the user for the radius and computes the area of a circle, to call our function cal

Plot the function, Consider the 3rd order Bessel function J3(x). Write a sc...

Consider the 3rd order Bessel function J3(x). Write a script findBessRoots.m that computes all the roots of J3(x) in the interval [0; 40]. Your script must store the roots of the f

Function with float and integer, hi i have this programm function [IRN,num...

hi i have this programm function [IRN,number ] = randnumbers( IRN ) IRN=int32(IRN) ITOTAL=(IRN*330)+100 ITOTAL=int32(ITOTAL); IQUOTIENT=ITOTAL/2303 IQUOTIENT=int32(IQUOTIENT);

Singal system , Q.1: Consider the transmission of a sinusoid x(t) = cos(2f...

Q.1: Consider the transmission of a sinusoid x(t) = cos(2f0t) through a channel a ected by multipath and Doppler. Let there be two paths, and assume the sinusoid is being sent fro

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd