Lab+Assignment+9

Lab+Assignment+9 - Assigned October 21 Fall 2011 Due...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Assigned: October 21 Fall 2011 Due: October 28 E7 Laboratory Assignment 9 This assignment is on solving non-linear equations in Matlab and an introduction to Linear Algebra. Note: You will use MATLAB’s publish command (accessible in the Editor window via File -> Publish Filename ) 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 type 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-file, which is used to generate the HTML document, and all of the function m-files that you create must also be uploaded to bSpace (under the Assignments tab) by noon on October 28. Please (i) have your full name, student ID number, and lab section number at the head of the file and (ii) name this file lastname middlename firstname lab09.m . Use the ”clear;format compact” 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 Text -> Wrap Comment . 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 % symbol) in your script file and explain why the error occurred. Part A: Bisection method and Newton’s method 1. Write a MATLAB function called bisectE7 that will perform the bisection algorithm to find the real roots of a real-valued function f . The function declaration line should be: begin code 1 function [r,rhistory,N,fError] = bisectE7(fHan,xL,xR,fTol,iterMax) end code The input arguments are: fHan : function handle of the function f ; xL : scalar, double , represents x left ; xR : scalar, double , represents x right ; fTol : stopping tolerance, used for absolute value of the function; interMax : maximum number of iterations allowed. The outputs of bisectE7 are: 1 of 10
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Assigned: October 21 Fall 2011 Due: October 28 r : the final estimate of the root obtained by the algorithm rhistory : a vector containing the sequence of midpoints obtained by the algorithm N : the number of iterations performed fError : the absolute value of the function evaluated at the computed solution The function bisectE7 should first check if either x L or x R satisfy the stopping criteria specified by fTol . If one (or both) satisfy the criteria, then that value (or the one that makes | f ( x ) | smallest) should be returned as the root, with N , the iteration count, set to
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/04/2011 for the course E 7 taught by Professor Patzek during the Fall '08 term at Berkeley.

Page1 / 10

Lab+Assignment+9 - Assigned October 21 Fall 2011 Due...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online