>> >> testroot1 *** root1 = 4.41 *** root2 = 1.59
Notice that Matlab automatically documents the purpose of each m-file. You can query the purpose of the m-file by simply typing:
>>
>> help bisection
BISECTION: root = bisection(func,xl,xu,es,maxit,verbose):
uses bisection method to find the root of a function
input:
func = name of function
xl, xu = lower and upper guesses
es = (optional) stopping criterion (%)
maxit = (optional) maximum allowable iterations
verbose = (optional) flag for verbose output
output:
root = real root
>>
>> help myfunc3
MYFUNC3: Compute f(x) = (x - 3)^3 - 2
>>