For example, assume that there is a motor driving link 2 (and determining the input angle $\theta_2$). The linkage relationships can be described by the following equation:
$l_1 + l_2 \cos \theta_2 - l_4 \cos \theta_4 = \sqrt{l_3^2 - (l_4 \sin \theta_4 - l_2 \sin \theta_2)^2}$
where $l_i$ is the length of link $i$. (Note that link 1 is an "implied link," and simply specifies the distance between the two rotational pivot points.)
Write a Matlab program that uses root finding to find the input angles ($\theta_2$) that would produce an output angle $\theta_4 = 80^\circ$, for the mechanism above with $l_1 = 6$ in, $l_2 = 4$ in, $l_3 = 7$ in, and $l_4 = 5.2$ in.
Your program should call a Matlab function that you write yourself (Bisect.m) that uses the bisection method discussed in class to find a root. Your function should be able to estimate and return a root of any function, given the brackets containing a root, the function handle, and a tolerance passed to it as input arguments. For full credit, your program should NOT use the fzero (or any other) built-in Matlab root finding functions. (However, you are encouraged to use the fzero function to get your main program working at first and for testing your root finding function by comparing the results to the fzero function.) If you cannot get your own Bisect.m root finding function working correctly, call the fzero function in your program instead of your own function, for partial credit