Create the flowchart for the Secant method.
Create an M-file secant.m with function:
function [x0, loopCount] = secant(fn, a, b, tolerance, max_loop_count)
with at least 3 inputs and up to 5 inputs, and two outputs.
% Inputs:
% fn - a handle to the target function for which the secant algorithm will attempt to find and return the zero
% a - first of two approximations to the zero of the target function
% b - second of two approximations to the zero of the target function
% tolerance (optional) - an acceptable error value to terminate the algorithm. The default is the square root of machine epsilon
% max_loop_count (optional) - the maximum number of times to execute the algorithm. The default value is 128
% Outputs:
% x0 - the value of the domain variable closest to the zero of the target function. abs(f(x0)) should be small unless the maximum loop count is exceeded or the secant algorithm fails
% loopCount - the number of iterations of the secant algorithm before terminating the algorithm
1. Remember to include your function trailer and header. Make sure you use comments, indentation, and whitespace.
2. Check your first three inputs for valid values. The MATLAB built-in function isa will be helpful.
3. Check your last two arguments and set their values to the specified defaults if necessary.
4. Implement the secant algorithm in a sub-function.