Unformatted text preview: ..almost. Here are the steps required: • In the "declaration line" for bisect , include a dummy function name. We might as well call it f , so the line becomes function approx_root = bisect ( f , a, b ) • Where we evaluated the function by writing f(x) , we now have to use the MATLAB "helper" function called feval . For instance, the line fa = cosy(a); must be rewritten as: fa = feval ( f, a ) ; • When we use bisect , we must include the function name, in quotes: x = bisect ( 'cosy' , 0, 3 ) Exercise : Follow the directions, and modify the file bisect.m so that the function name is a variable. Once you are done, see if the command x = bisect ( 'cosy', 0, 3 ) is acceptable to MATLAB and produces the same root as before....
View Full Document
- Variable Function Names, bisect routine treats