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

Matlab code using ant colony algorithm, Ant Colony Optimization for Optimiz...

Ant Colony Optimization for Optimization of Route path taken Ant Colony Algorithm is a potential candidate for coupled, 3D optimisation. Ant Colony Algorithm enjoys the overall

Expert system, how can i write a programm about maze solver expert system o...

how can i write a programm about maze solver expert system only with if & then

Discuss the frequency range and radiation angles, Discuss the frequency ran...

Discuss the frequency range / radiation angles at which the two models diverge, and relate this divergence to your understanding of the behaviour of a pistonic source. Compare t

Illustration of modifying elements, Illustration of Modifying Elements: ...

Illustration of Modifying Elements: Illustration, the fifth element in the vector newvec is 9 >> newvec(5) ans = 9 The subset of a vector, that would be a vector it

Sorting and curve fitting in matlab, Goal: Learn how to do statistics, sort...

Goal: Learn how to do statistics, sorting and curve fitting in Matlab. Put all of those ".m" files in a folder called yourname_lab7, and zip the folder and submit it on the class w

Flow chart, conversion of decimal to binary

conversion of decimal to binary

Program that perform k nearest neighbours algorithm, 1) Convert the table i...

1) Convert the table into format convenient for the processing with MATLAB. 2) Prepare a program that perform K Nearest Neighbours algorithm using Euclidian distance. (Your prog

#GUI, #create a matlab GUI for designing common emitter amplifier which pro...

#create a matlab GUI for designing common emitter amplifier which produces AC load lines based on the component values

Calculate the bandwidth of this filter matlab, The purpose of this lab is ...

The purpose of this lab is to enhance the ECE311 student's understanding of filter behavior and filter design and to provide the student the opportunity to demonstrate skills in li

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