Assigned: October 21
Due: October 28
E7 Laboratory Assignment 9
This assignment is on solving non-linear equations in Matlab and an introduction to Linear Algebra.
You will use MATLAB’s
command (accessible in the Editor window via
) to generate a printable document that contains your code and your answers.
1. You must turn in a printed copy to the homework boxes in room 1109 Etcheverry.
Further, you will
need to use the command
to display your functions in your main script. You will not get
credit for the functions you have written unless you display them!
Be sure to turn your printout
into the box corresponding to the lab section in which you are registered. The due-date is 12:00 pm
(noon) on October 28.
2. Your primary m-ﬁle, which is used to generate the HTML document, and all of the function m-ﬁles
that you create must also be uploaded to bSpace (under the
tab) by noon on October
Please (i) have your full name, student ID number, and lab section number at the head of the ﬁle and
(ii) name this ﬁle
command at the beginning of your script to clear the variables from
the base workspace and format appropriately to reduce the length of the output. If your comments
exceed the page border, highlight the comment and go to
In several problems, you are asked to execute a number of given lines, and explain (in a comment before
the line) what the command does. Some lines might produce an error (this is deliberate, on our part).
In that case, after you understand what is the issue, comment out that line (using the
your script ﬁle and explain why the error occurred.
Part A: Bisection method and Newton’s method
1. Write a MATLAB function called
that will perform the bisection algorithm to ﬁnd the
real roots of a real-valued function
. The function declaration line should be:
function [r,rhistory,N,fError] = bisectE7(fHan,xL,xR,fTol,iterMax)
The input arguments are:
: function handle of the function
: stopping tolerance, used for absolute value of the function;
: maximum number of iterations allowed.
The outputs of
1 of 10